pub struct TextDocument { /* private fields */ }Expand description
A collaborative plain text document backed by RGAText.
Implementations§
Source§impl TextDocument
impl TextDocument
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 replace(&mut self, start: usize, end: usize, text: &str)
pub fn splice(&mut self, position: usize, delete_count: usize, insert: &str)
pub fn get_text(&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<TextDocument, JsValue>
Trait Implementations§
Source§impl From<TextDocument> for JsValue
impl From<TextDocument> for JsValue
Source§fn from(value: TextDocument) -> Self
fn from(value: TextDocument) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for TextDocument
impl FromWasmAbi for TextDocument
Source§impl IntoWasmAbi for TextDocument
impl IntoWasmAbi for TextDocument
Source§impl LongRefFromWasmAbi for TextDocument
impl LongRefFromWasmAbi for TextDocument
Source§impl OptionFromWasmAbi for TextDocument
impl OptionFromWasmAbi for TextDocument
Source§impl OptionIntoWasmAbi for TextDocument
impl OptionIntoWasmAbi for TextDocument
Source§impl RefFromWasmAbi for TextDocument
impl RefFromWasmAbi for TextDocument
Source§type Anchor = RcRef<TextDocument>
type Anchor = RcRef<TextDocument>
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 TextDocument
impl RefMutFromWasmAbi for TextDocument
Source§impl TryFromJsValue for TextDocument
impl TryFromJsValue for TextDocument
Source§impl VectorFromWasmAbi for TextDocument
impl VectorFromWasmAbi for TextDocument
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[TextDocument]>
Source§impl VectorIntoWasmAbi for TextDocument
impl VectorIntoWasmAbi for TextDocument
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[TextDocument]>) -> Self::Abi
Source§impl WasmDescribeVector for TextDocument
impl WasmDescribeVector for TextDocument
impl SupportsConstructor for TextDocument
impl SupportsInstanceProperty for TextDocument
impl SupportsStaticProperty for TextDocument
Auto Trait Implementations§
impl Freeze for TextDocument
impl RefUnwindSafe for TextDocument
impl Send for TextDocument
impl Sync for TextDocument
impl Unpin for TextDocument
impl UnsafeUnpin for TextDocument
impl UnwindSafe for TextDocument
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.