Trait yrs::WriteTxn

source ·
pub trait WriteTxn: Sized {
    // Required methods
    fn store_mut(&mut self) -> &mut Store;
    fn subdocs_mut(&mut self) -> &mut Subdocs;

    // Provided methods
    fn get_or_insert_text<N: Into<Arc<str>>>(&mut self, name: N) -> TextRef { ... }
    fn get_or_insert_map<N: Into<Arc<str>>>(&mut self, name: N) -> MapRef { ... }
    fn get_or_insert_array<N: Into<Arc<str>>>(&mut self, name: N) -> ArrayRef { ... }
    fn get_or_insert_xml_fragment<N: Into<Arc<str>>>(
        &mut self,
        name: N
    ) -> XmlFragmentRef { ... }
}

Required Methods§

source

fn store_mut(&mut self) -> &mut Store

source

fn subdocs_mut(&mut self) -> &mut Subdocs

Provided Methods§

source

fn get_or_insert_text<N: Into<Arc<str>>>(&mut self, name: N) -> TextRef

Returns a TextRef data structure stored under a given name. Text structures are used for collaborative text editing: they expose operations to append and remove chunks of text, which are free to execute concurrently by multiple peers over remote boundaries.

If no structure under defined name existed before, it will be created and returned instead.

If a structure under defined name already existed, but its type was different it will be reinterpreted as a text (in such case a sequence component of complex data type will be interpreted as a list of text chunks).

source

fn get_or_insert_map<N: Into<Arc<str>>>(&mut self, name: N) -> MapRef

Returns a MapRef data structure stored under a given name. Maps are used to store key-value pairs associated. These values can be primitive data (similar but not limited to a JavaScript Object Notation) as well as other shared types (Yrs maps, arrays, text structures etc.), enabling to construct a complex recursive tree structures.

If no structure under defined name existed before, it will be created and returned instead.

If a structure under defined name already existed, but its type was different it will be reinterpreted as a map (in such case a map component of complex data type will be interpreted as native map).

source

fn get_or_insert_array<N: Into<Arc<str>>>(&mut self, name: N) -> ArrayRef

Returns an ArrayRef data structure stored under a given name. Array structures are used for storing a sequences of elements in ordered manner, positioning given element accordingly to its index.

If no structure under defined name existed before, it will be created and returned instead.

If a structure under defined name already existed, but its type was different it will be reinterpreted as an array (in such case a sequence component of complex data type will be interpreted as a list of inserted values).

source

fn get_or_insert_xml_fragment<N: Into<Arc<str>>>( &mut self, name: N ) -> XmlFragmentRef

Returns a XmlFragmentRef data structure stored under a given name. XML elements represent nodes of XML document. They can contain attributes (key-value pairs, both of string type) as well as other nested XML elements or text values, which are stored in their insertion order.

If no structure under defined name existed before, it will be created and returned instead.

If a structure under defined name already existed, but its type was different it will be reinterpreted as a XML element (in such case a map component of complex data type will be interpreted as map of its attributes, while a sequence component - as a list of its child XML nodes).

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'doc> WriteTxn for TransactionMut<'doc>