pub struct CrdtDoc { /* private fields */ }Expand description
CRDT document wrapping a Yjs Doc for conflict-free merging.
Implementations§
Source§impl CrdtDoc
impl CrdtDoc
Sourcepub fn from_text(content: &str) -> Self
pub fn from_text(content: &str) -> Self
Create a new CRDT document initialized with the given text content.
Sourcepub fn apply_edit(&self, offset: u32, delete_len: u32, insert: &str)
pub fn apply_edit(&self, offset: u32, delete_len: u32, insert: &str)
Apply a local edit: delete delete_len chars at offset, then insert insert there.
Sourcepub fn encode_state(&self) -> Vec<u8> ⓘ
pub fn encode_state(&self) -> Vec<u8> ⓘ
Encode the full document state (for persistence).
Sourcepub fn decode_state(bytes: &[u8]) -> Result<Self>
pub fn decode_state(bytes: &[u8]) -> Result<Self>
Decode a previously encoded state into a new CrdtDoc.
Auto Trait Implementations§
impl Freeze for CrdtDoc
impl !RefUnwindSafe for CrdtDoc
impl Send for CrdtDoc
impl Sync for CrdtDoc
impl Unpin for CrdtDoc
impl UnsafeUnpin for CrdtDoc
impl !UnwindSafe for CrdtDoc
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