From d6029678c767da5ad48b299acce382808f2b1df8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 15 Feb 2016 13:27:40 +0100 Subject: [PATCH] Implement InternalLinker for Entry, for convenience --- libimaglink/src/internal.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libimaglink/src/internal.rs b/libimaglink/src/internal.rs index bfee3c64..39750fae 100644 --- a/libimaglink/src/internal.rs +++ b/libimaglink/src/internal.rs @@ -1,3 +1,4 @@ +use libimagstore::store::Entry; use libimagstore::store::EntryHeader; use libimagstore::store::Result as StoreResult; @@ -54,6 +55,25 @@ impl InternalLinker for EntryHeader { } +impl InternalLinker for Entry { + + fn get_internal_links(&self) -> Result { + self.get_header().get_internal_links() + } + + fn set_internal_links(&mut self, links: Links) -> Result { + self.get_header_mut().set_internal_links(links) + } + + fn add_internal_link(&mut self, link: Link) -> Result<()> { + self.get_header_mut().add_internal_link(link) + } + + fn remove_internal_link(&mut self, link: Link) -> Result<()> { + self.get_header_mut().remove_internal_link(link) + } +} + fn process_rw_result(links: StoreResult>) -> Result { if links.is_err() { let lerr = LinkError::new(LinkErrorKind::EntryHeaderReadError,