Trait oatie::OT
[−]
[src]
pub trait OT where
Self: Sized, { type Doc; fn apply(_: &Self::Doc, _: &Self) -> Self::Doc; fn empty() -> Self; fn compose(_: &Self, _: &Self) -> Self; fn compose_iter<'a, I>(iter: I) -> Self
where
I: Iterator<Item = &'a Self>,
Self: 'a; fn transform<S: Schema>(_: &Self, _: &Self) -> (Self, Self); fn transform_advance<S: Schema>(a: &Self, b: &Self) -> Self; }
A type that can have operational transform applied to it.
The OT
trait is implemented on an operation object, and its
associated type Doc
is what the operation should operate on.
Associated Types
type Doc
Required Methods
fn apply(_: &Self::Doc, _: &Self) -> Self::Doc
Applies an operation to a Self::Doc
, returning the modified Self::Doc
.
fn empty() -> Self
Returns an empty operation.
fn compose(_: &Self, _: &Self) -> Self
Composes two operations, returning a single operation encapsulating them both.
fn compose_iter<'a, I>(iter: I) -> Self where
I: Iterator<Item = &'a Self>,
Self: 'a,
I: Iterator<Item = &'a Self>,
Self: 'a,
Composes an iterator of operations into a single operation. If no operations are returned from the iterator, the OT::empty() should be returned.
fn transform<S: Schema>(_: &Self, _: &Self) -> (Self, Self)
Transform a document given the corresponding Schema trait.
fn transform_advance<S: Schema>(a: &Self, b: &Self) -> Self
Utility function to transform an operation against a competing one, returning the results of composing them both.