pub struct RichTextDocument { /* private fields */ }Expand description
Explicit rich text wrapper for SDK-style API naming.
This wraps CollaborativeDocument and exposes the same rich-text CRDT behavior.
Implementations§
Source§impl RichTextDocument
impl RichTextDocument
pub fn new(doc_id: &str, replica_id: &str) -> Self
pub fn insert(&mut self, position: usize, text: &str)
pub fn delete(&mut self, position: usize, length: usize)
pub fn apply_bold(&mut self, start: usize, end: usize)
pub fn apply_italic(&mut self, start: usize, end: usize)
pub fn apply_underline(&mut self, start: usize, end: usize)
pub fn apply_strikethrough(&mut self, start: usize, end: usize)
pub fn apply_code(&mut self, start: usize, end: usize)
pub fn apply_link(&mut self, start: usize, end: usize, url: &str)
pub fn apply_highlight(&mut self, start: usize, end: usize, color: &str)
pub fn apply_comment( &mut self, start: usize, end: usize, author: &str, content: &str, )
pub fn apply_custom_mark( &mut self, start: usize, end: usize, name: &str, value: &str, )
pub fn get_text(&self) -> String
pub fn get_html(&self) -> String
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn version(&self) -> u64
pub fn doc_id(&self) -> String
pub fn replica_id(&self) -> String
pub fn serialize(&self) -> Result<String, JsValue>
pub fn merge(&mut self, remote_state: &str) -> Result<(), JsValue>
pub fn snapshot(&self) -> Result<JsValue, JsValue>
pub fn restore(snapshot_js: JsValue) -> Result<RichTextDocument, JsValue>
Trait Implementations§
Source§impl From<RichTextDocument> for JsValue
impl From<RichTextDocument> for JsValue
Source§fn from(value: RichTextDocument) -> Self
fn from(value: RichTextDocument) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for RichTextDocument
impl FromWasmAbi for RichTextDocument
Source§impl IntoWasmAbi for RichTextDocument
impl IntoWasmAbi for RichTextDocument
Source§impl OptionFromWasmAbi for RichTextDocument
impl OptionFromWasmAbi for RichTextDocument
Source§impl OptionIntoWasmAbi for RichTextDocument
impl OptionIntoWasmAbi for RichTextDocument
Source§impl RefFromWasmAbi for RichTextDocument
impl RefFromWasmAbi for RichTextDocument
Source§type Anchor = RcRef<RichTextDocument>
type Anchor = RcRef<RichTextDocument>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for RichTextDocument
impl RefMutFromWasmAbi for RichTextDocument
Source§impl TryFromJsValue for RichTextDocument
impl TryFromJsValue for RichTextDocument
Source§impl VectorFromWasmAbi for RichTextDocument
impl VectorFromWasmAbi for RichTextDocument
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[RichTextDocument]>
Source§impl VectorIntoWasmAbi for RichTextDocument
impl VectorIntoWasmAbi for RichTextDocument
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[RichTextDocument]>) -> Self::Abi
Source§impl WasmDescribeVector for RichTextDocument
impl WasmDescribeVector for RichTextDocument
impl SupportsConstructor for RichTextDocument
impl SupportsInstanceProperty for RichTextDocument
impl SupportsStaticProperty for RichTextDocument
Auto Trait Implementations§
impl Freeze for RichTextDocument
impl RefUnwindSafe for RichTextDocument
impl Send for RichTextDocument
impl Sync for RichTextDocument
impl Unpin for RichTextDocument
impl UnsafeUnpin for RichTextDocument
impl UnwindSafe for RichTextDocument
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
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.