pub struct RichTextDoc { /* private fields */ }Expand description
A collaborative rich text document with formatting.
Implementations§
Source§impl RichTextDoc
impl RichTextDoc
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 rich text document.
Sourcepub fn format(&mut self, start: usize, end: usize, mark: MarkType)
pub fn format(&mut self, start: usize, end: usize, mark: MarkType)
Apply formatting to a range.
Sourcepub fn unformat_by_id(&mut self, mark_id: &MarkId)
pub fn unformat_by_id(&mut self, mark_id: &MarkId)
Remove formatting by mark ID.
Sourcepub fn get_content(&self) -> String
pub fn get_content(&self) -> String
Get the plain text as spans with marks. Note: For full mark information, use the underlying RichText directly.
Sourcepub fn merge(&mut self, other: &RichTextDoc)
pub fn merge(&mut self, other: &RichTextDoc)
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) -> RichTextDoc
pub fn clone_state(&self) -> RichTextDoc
Clone this document’s state for syncing to another replica.
Trait Implementations§
Source§impl Clone for RichTextDoc
impl Clone for RichTextDoc
Source§fn clone(&self) -> RichTextDoc
fn clone(&self) -> RichTextDoc
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CollaborativeDoc for RichTextDoc
impl CollaborativeDoc for RichTextDoc
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 RichTextDoc
impl !RefUnwindSafe for RichTextDoc
impl Send for RichTextDoc
impl Sync for RichTextDoc
impl Unpin for RichTextDoc
impl !UnwindSafe for RichTextDoc
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