Struct yrs::Transaction

source ·
pub struct Transaction<'doc> { /* private fields */ }
Expand description

A very lightweight read-only transaction. These transactions are guaranteed to not modify the contents of an underlying Doc and can be used to read it or for serialization purposes. For this reason it’s allowed to have a multiple active read-only transactions, but it’s not allowed to have any active read-write transactions at the same time.

Trait Implementations§

source§

impl<'doc> Debug for Transaction<'doc>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'doc> ReadTxn for Transaction<'doc>

source§

fn store(&self) -> &Store

source§

fn state_vector(&self) -> StateVector

Returns state vector describing current state of the updates.
source§

fn snapshot(&self) -> Snapshot

Returns a snapshot which describes a current state of updates and removals made within the corresponding document.
source§

fn encode_state_from_snapshot<E: Encoder>( &self, snapshot: &Snapshot, encoder: &mut E ) -> Result<(), Error>

Encodes all changes from current transaction block store up to a given snapshot. This enables to encode state of a document at some specific point in the past.
source§

fn encode_diff<E: Encoder>(&self, state_vector: &StateVector, encoder: &mut E)

Encodes the difference between remove peer state given its state_vector and the state of a current local peer
source§

fn encode_diff_v1(&self, state_vector: &StateVector) -> Vec<u8>

source§

fn encode_state_as_update<E: Encoder>(&self, sv: &StateVector, encoder: &mut E)

source§

fn encode_state_as_update_v1(&self, sv: &StateVector) -> Vec<u8>

source§

fn encode_state_as_update_v2(&self, sv: &StateVector) -> Vec<u8>

source§

fn root_refs(&self) -> RootRefs<'_>

Returns an iterator over top level (root) shared types available in current Doc.
source§

fn subdoc_guids(&self) -> SubdocGuids<'_>

Returns a collection of globally unique identifiers of sub documents linked within the structures of this document store.
source§

fn subdocs(&self) -> SubdocsIter<'_>

Returns a collection of sub documents linked within the structures of this document store.
source§

fn get_text(&self, name: &str) -> Option<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. Read more
source§

fn get_array(&self, name: &str) -> Option<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. Read more
source§

fn get_map(&self, name: &str) -> Option<MapRef>

Returns a MapRef data structure stored under a given 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 more
source§

fn get_xml_fragment(&self, name: &str) -> Option<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. Read more
source§

fn get_xml_element(&self, name: &str) -> Option<XmlElementRef>

Returns a XmlElementRef 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. Read more
source§

fn get_xml_text(&self, name: &str) -> Option<XmlTextRef>

Returns a XmlTextRef 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. Read more

Auto Trait Implementations§

§

impl<'doc> !RefUnwindSafe for Transaction<'doc>

§

impl<'doc> !Send for Transaction<'doc>

§

impl<'doc> !Sync for Transaction<'doc>

§

impl<'doc> Unpin for Transaction<'doc>

§

impl<'doc> !UnwindSafe for Transaction<'doc>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V