lib: Add remove_link()
This commit is contained in:
parent
b7a5f57e3a
commit
277c31237a
1 changed files with 7 additions and 0 deletions
|
@ -25,6 +25,13 @@ pub fn add_link(header: &mut EntryHeader, link: Link) -> Result<()> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn remove_link(header: &mut EntryHeader, link: Link) -> Result<()> {
|
||||
get_links(header).and_then(|mut links| {
|
||||
links.remove(link);
|
||||
set_links(header, links).map(|_| ())
|
||||
})
|
||||
}
|
||||
|
||||
fn process_rw_result(links: StoreResult<Option<Value>>) -> Result<Links> {
|
||||
if links.is_err() {
|
||||
let lerr = LinkError::new(LinkErrorKind::EntryHeaderReadError,
|
||||
|
|
Loading…
Reference in a new issue