Struct yrs::TransactionMut
source · pub struct TransactionMut<'doc> { /* private fields */ }Implementations§
source§impl<'doc> TransactionMut<'doc>
impl<'doc> TransactionMut<'doc>
sourcepub fn before_state(&self) -> &StateVector
pub fn before_state(&self) -> &StateVector
Corresponding document’s state vector at the moment when current transaction was created.
sourcepub fn after_state(&self) -> &StateVector
pub fn after_state(&self) -> &StateVector
Current document state vector which includes changes made by this transaction.
sourcepub fn delete_set(&self) -> &DeleteSet
pub fn delete_set(&self) -> &DeleteSet
Data about deletions performed in the scope of current transaction.
sourcepub fn encode_update_v1(&self) -> Vec<u8>
pub fn encode_update_v1(&self) -> Vec<u8>
Encodes changes made within the scope of the current transaction using lib0 v1 encoding.
Document updates are idempotent and commutative. Caveats:
- It doesn’t matter in which order document updates are applied.
- As long as all clients receive the same document updates, all clients end up with the same content.
- Even if an update contains known information, the unknown information is extracted and integrated into the document structure.
sourcepub fn encode_update_v2(&self) -> Vec<u8>
pub fn encode_update_v2(&self) -> Vec<u8>
Encodes changes made within the scope of the current transaction using lib0 v2 encoding.
Document updates are idempotent and commutative. Caveats:
- It doesn’t matter in which order document updates are applied.
- As long as all clients receive the same document updates, all clients end up with the same content.
- Even if an update contains known information, the unknown information is extracted and integrated into the document structure.
sourcepub fn encode_update<E: Encoder>(&self, encoder: &mut E)
pub fn encode_update<E: Encoder>(&self, encoder: &mut E)
Encodes changes made within the scope of the current transaction.
Document updates are idempotent and commutative. Caveats:
- It doesn’t matter in which order document updates are applied.
- As long as all clients receive the same document updates, all clients end up with the same content.
- Even if an update contains known information, the unknown information is extracted and integrated into the document structure.
sourcepub fn apply_update(&mut self, update: Update)
pub fn apply_update(&mut self, update: Update)
Applies a deserialized update contents into a document owning current transaction.
sourcepub fn commit(&mut self)
pub fn commit(&mut self)
Commits current transaction. This step involves cleaning up and optimizing changes performed during lifetime of a transaction. Such changes include squashing delete sets data or squashing blocks that have been appended one after another to preserve memory.
This step is performed automatically when a transaction is about to be dropped (its life scope comes to an end).
Trait Implementations§
source§impl<'doc> Drop for TransactionMut<'doc>
impl<'doc> Drop for TransactionMut<'doc>
source§impl<'doc> ReadTxn for TransactionMut<'doc>
impl<'doc> ReadTxn for TransactionMut<'doc>
fn store(&self) -> &Store
source§fn state_vector(&self) -> StateVector
fn state_vector(&self) -> StateVector
source§fn snapshot(&self) -> Snapshot
fn snapshot(&self) -> Snapshot
source§fn encode_state_from_snapshot<E: Encoder>(
&self,
snapshot: &Snapshot,
encoder: &mut E
) -> Result<(), Error>
fn encode_state_from_snapshot<E: Encoder>(
&self,
snapshot: &Snapshot,
encoder: &mut E
) -> Result<(), Error>
snapshot.
This enables to encode state of a document at some specific point in the past. Read moresource§fn encode_diff<E: Encoder>(&self, state_vector: &StateVector, encoder: &mut E)
fn encode_diff<E: Encoder>(&self, state_vector: &StateVector, encoder: &mut E)
state_vector and the state
of a current local peer Read morefn encode_diff_v1(&self, state_vector: &StateVector) -> Vec<u8>
fn encode_state_as_update<E: Encoder>(&self, sv: &StateVector, encoder: &mut E)
fn encode_state_as_update_v1(&self, sv: &StateVector) -> Vec<u8>
fn encode_state_as_update_v2(&self, sv: &StateVector) -> Vec<u8>
source§fn root_refs(&self) -> RootRefs<'_> ⓘ
fn root_refs(&self) -> RootRefs<'_> ⓘ
source§fn subdoc_guids(&self) -> SubdocGuids<'_>
fn subdoc_guids(&self) -> SubdocGuids<'_>
source§fn subdocs(&self) -> SubdocsIter<'_>
fn subdocs(&self) -> SubdocsIter<'_>
source§fn get_map(&self, name: &str) -> Option<MapRef>
fn get_map(&self, name: &str) -> Option<MapRef>
name. Maps are used to store key-value
pairs associated together. 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. Read moresource§fn get_xml_fragment(&self, name: &str) -> Option<XmlFragmentRef>
fn get_xml_fragment(&self, name: &str) -> Option<XmlFragmentRef>
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. Read moresource§fn get_xml_element(&self, name: &str) -> Option<XmlElementRef>
fn get_xml_element(&self, name: &str) -> Option<XmlElementRef>
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. Read moresource§fn get_xml_text(&self, name: &str) -> Option<XmlTextRef>
fn get_xml_text(&self, name: &str) -> Option<XmlTextRef>
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. Read more