Trait AsyncTransact
pub trait AsyncTransact<'doc> {
type Read: Future<Output = Transaction<'doc>>;
type Write: Future<Output = TransactionMut<'doc>>;
// Required methods
fn transact(&'doc self) -> Self::Read;
fn transact_mut(&'doc self) -> Self::Write;
fn transact_mut_with<T>(&'doc self, origin: T) -> Self::Write
where T: Into<Origin>;
}Expand description
Trait implemented by Doc and shared types, used for carrying over the responsibilities of creating new transactions, used as a unit of work in Yrs.
Required Associated Types§
type Read: Future<Output = Transaction<'doc>>
type Write: Future<Output = TransactionMut<'doc>>
Required Methods§
fn transact(&'doc self) -> Self::Read
fn transact_mut(&'doc self) -> Self::Write
fn transact_mut_with<T>(&'doc self, origin: T) -> Self::Write
fn transact_mut_with<T>(&'doc self, origin: T) -> Self::Write
Creates and returns a read-write capable transaction with an origin classifier attached.
This transaction can be used to mutate the contents of underlying document store and upon
dropping or committing it may subscription callbacks.
An origin may be used to identify context of operations made (example updates performed
locally vs. incoming from remote replicas) and it’s used i.e. by UndoManager.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.