pub struct DocCell(/* private fields */);Expand description
Shared mutable document for write-through-read state access.
All state reads lock briefly to fetch the current value, and all writes apply the operation in-place so the next read sees the update.
Implementations§
Source§impl DocCell
impl DocCell
Sourcepub fn get(&self) -> MutexGuard<'_, Value>
pub fn get(&self) -> MutexGuard<'_, Value>
Acquire a read lock on the document.
The returned guard dereferences to &Value. Callers should clone
any needed data before dropping the guard.
Sourcepub fn apply(&self, op: &Op) -> TireaResult<()>
pub fn apply(&self, op: &Op) -> TireaResult<()>
Apply a single operation to the document in-place.
Apply an operation and return any validation/type error.
Sourcepub fn into_inner(self) -> Value
pub fn into_inner(self) -> Value
Consume the DocCell and return the inner value.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DocCell
impl RefUnwindSafe for DocCell
impl Send for DocCell
impl Sync for DocCell
impl Unpin for DocCell
impl UnwindSafe for DocCell
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