Implement internal::set_links()

This commit is contained in:
Matthias Beyer 2016-02-07 16:40:33 +01:00
parent 950dce945f
commit a53d36c23d

View file

@ -10,8 +10,11 @@ pub fn get_links(header: &EntryHeader) -> Result<Links> {
process_rw_result(header.read("imag.links")) process_rw_result(header.read("imag.links"))
} }
/// Set the links in a header and return the old links, if any.
pub fn set_links(header: &mut EntryHeader, links: Links) -> Result<Links> { pub fn set_links(header: &mut EntryHeader, links: Links) -> Result<Links> {
unimplemented!() let links : Vec<Link> = links.into();
let links : Vec<Value> = links.into_iter().map(|link| Value::String(link.into())).collect();
process_rw_result(header.set("imag.links", Value::Array(links)))
} }
pub fn add_link(header: &mut EntryHeader, link: Link) -> Result<()> { pub fn add_link(header: &mut EntryHeader, link: Link) -> Result<()> {