pub struct TextDoc { /* private fields */ }Expand description
A collaborative plain text document.
Implementations§
Source§impl TextDoc
impl TextDoc
Sourcepub fn new(id: impl Into<String>, replica_id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>, replica_id: impl Into<String>) -> Self
Create a new text document.
Sourcepub fn merge(&mut self, other: &TextDoc)
pub fn merge(&mut self, other: &TextDoc)
Merge another document’s state into this one (CRDT merge). This applies changes from the other document while preserving local changes.
Sourcepub fn clone_state(&self) -> TextDoc
pub fn clone_state(&self) -> TextDoc
Clone this document’s state for syncing to another replica.
Trait Implementations§
Source§impl CollaborativeDoc for TextDoc
impl CollaborativeDoc for TextDoc
Source§fn replica_id(&self) -> &str
fn replica_id(&self) -> &str
Get the replica ID.
Source§fn apply_remote(&mut self, _delta: &[u8])
fn apply_remote(&mut self, _delta: &[u8])
Apply a remote delta.
Auto Trait Implementations§
impl Freeze for TextDoc
impl !RefUnwindSafe for TextDoc
impl Send for TextDoc
impl Sync for TextDoc
impl Unpin for TextDoc
impl !UnwindSafe for TextDoc
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