pub struct Transaction<'a> { /* private fields */ }Expand description
A transaction for batched mutations.
Transactions capture the agent ID so you don’t need to pass it to each mutation. They also provide a clean solution to Rust’s borrow checker issues when working with nested CRDTs.
Transactions are created by Document::transact() and cannot be created
directly.
Implementations§
Source§impl<'a> Transaction<'a>
impl<'a> Transaction<'a>
Sourcepub fn get_map_mut(&mut self, path: &[&str]) -> Option<MapMut<'_>>
pub fn get_map_mut(&mut self, path: &[&str]) -> Option<MapMut<'_>>
Get a mutable reference to a map at the given path. Returns None if path doesn’t exist.
Sourcepub fn get_text_mut(&mut self, path: &[&str]) -> Option<TextMut<'_>>
pub fn get_text_mut(&mut self, path: &[&str]) -> Option<TextMut<'_>>
Get a mutable reference to a text CRDT at the given path. Returns None if path doesn’t exist or isn’t a Text.
Sourcepub fn get_set_mut(&mut self, path: &[&str]) -> Option<SetMut<'_>>
pub fn get_set_mut(&mut self, path: &[&str]) -> Option<SetMut<'_>>
Get a mutable reference to a set CRDT at the given path. Returns None if path doesn’t exist or isn’t a Set.
Sourcepub fn map_by_id(&mut self, id: CrdtId) -> MapMut<'_>
pub fn map_by_id(&mut self, id: CrdtId) -> MapMut<'_>
Get a mutable reference to a map by its CRDT ID.
Sourcepub fn text_by_id(&mut self, id: CrdtId) -> Option<TextMut<'_>>
pub fn text_by_id(&mut self, id: CrdtId) -> Option<TextMut<'_>>
Get a mutable reference to a text CRDT by its ID.
Auto Trait Implementations§
impl<'a> Freeze for Transaction<'a>
impl<'a> RefUnwindSafe for Transaction<'a>
impl<'a> Send for Transaction<'a>
impl<'a> Sync for Transaction<'a>
impl<'a> Unpin for Transaction<'a>
impl<'a> UnsafeUnpin for Transaction<'a>
impl<'a> !UnwindSafe for Transaction<'a>
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