pub struct ReadLock<'a, Element> { /* private fields */ }Expand description
A read lock for an element in an RwStore.
The lock will automatically be released when this is dropped.
§Example
let store = RwStore::new();
let id = store.insert(42);
let read_lock = store.read(id).unwrap();
assert_eq!(*read_lock, 42);
assert!(store.write_with_timeout(id, DontBlock).is_err());
mem::drop(read_lock);
assert!(store.write_with_timeout(id, DontBlock).is_ok());Trait Implementations§
impl<'a, Element: Sync> Sync for ReadLock<'a, Element>
Auto Trait Implementations§
impl<'a, Element> Freeze for ReadLock<'a, Element>
impl<'a, Element> RefUnwindSafe for ReadLock<'a, Element>where
Element: RefUnwindSafe,
impl<'a, Element> !Send for ReadLock<'a, Element>
impl<'a, Element> Unpin for ReadLock<'a, Element>
impl<'a, Element> UnwindSafe for ReadLock<'a, Element>where
Element: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more