From 52f70e5b71894501354f9404e956a4d4994a4d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Sat, 16 Jan 2016 18:25:48 +0100 Subject: [PATCH] Add FileLockEntry --- libimagstore/src/store.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index d7b2e7c1..27563e6b 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -23,3 +23,31 @@ pub trait Store { } +pub struct FileLockEntry<'a, S: Store + 'a> { + store: &'a S, + entry: Entry +} + +impl<'a, S: Store + 'a> FileLockEntry<'a, S > { + fn new(store: &'a S, entry: Entry) -> FileLockEntry<'a, S> { + FileLockEntry { + store: store, + entry: entry, + } + } +} + +impl<'a, S: Store + 'a> ::std::ops::Deref for FileLockEntry<'a, S> { + type Target = Entry; + + fn deref(&self) -> &Self::Target { + &self.entry + } +} + +impl<'a, S: Store + 'a> ::std::ops::DerefMut for FileLockEntry<'a, S> { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.entry + } +} +