Struct read_write_store::lock::WriteLock [−][src]
pub struct WriteLock<'a, Element> { /* fields omitted */ }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());