pub struct WriteLock<'a, Element> { /* private fields */ }Expand description
A write 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 mut write_lock = store.write(id).unwrap();
*write_lock = 24;
assert_eq!(*write_lock, 24);
assert!(store.read_with_timeout(id, DontBlock).is_err());
mem::drop(write_lock);
assert!(store.read_with_timeout(id, DontBlock).is_ok());Trait Implementations§
Source§impl<'a, Element> DerefMut for WriteLock<'a, Element>
impl<'a, Element> DerefMut for WriteLock<'a, Element>
Source§fn deref_mut(&mut self) -> &mut Element
fn deref_mut(&mut self) -> &mut Element
Mutably dereferences the value.
impl<'a, Element: Sync> Sync for WriteLock<'a, Element>
Auto Trait Implementations§
impl<'a, Element> Freeze for WriteLock<'a, Element>
impl<'a, Element> RefUnwindSafe for WriteLock<'a, Element>where
Element: RefUnwindSafe,
impl<'a, Element> !Send for WriteLock<'a, Element>
impl<'a, Element> Unpin for WriteLock<'a, Element>
impl<'a, Element> UnwindSafe for WriteLock<'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