[−][src]Struct operational_transform::OperationSeq 
A sequence of Operations on text.
Implementations
impl OperationSeq[src]
pub fn with_capacity(capacity: usize) -> Self[src]
Creates a store for operatations which does not need to allocate  until
capacity operations have been stored inside.
pub fn compose(&self, other: &Self) -> Result<Self, OTError>[src]
Merges the operation with other into one operation while preserving
the changes of both. Or, in other words, for each input string S and a
pair of consecutive operations A and B.
apply(apply(S, A), B) = apply(S, compose(A, B))
must hold.
Error
Returns an OTError if the operations are not composable due to length
conflicts.
pub fn delete(&mut self, n: u64)[src]
Deletes n characters at the current cursor position.
pub fn insert(&mut self, s: &str)[src]
Inserts a s at the current cursor position.
pub fn retain(&mut self, n: u64)[src]
Moves the cursor n characters forwards.
pub fn transform(&self, other: &Self) -> Result<(Self, Self), OTError>[src]
Transforms two operations A and B that happened concurrently and produces
two operations A' and B' (in an array) such that
apply(apply(S, A), B') = apply(apply(S, B), A').
This function is the heart of OT.
Error
Returns an OTError if the operations cannot be transformed due to
length conflicts.
pub fn apply(&self, s: &str) -> Result<String, OTError>[src]
Applies an operation to a string, returning a new string.
Error
Returns an error if the operation cannot be applied due to length conflicts.
pub fn invert(&self, s: &str) -> Self[src]
Computes the inverse of an operation. The inverse of an operation is the operation that reverts the effects of the operation, e.g. when you have an operation 'insert("hello "); skip(6);' then the inverse is 'delete("hello "); skip(6);'. The inverse should be used for implementing undo.
pub fn is_noop(&self) -> bool[src]
Checks if this operation has no effect.
pub fn base_len(&self) -> usize[src]
Returns the length of a string these operations can be applied to
pub fn target_len(&self) -> usize[src]
Returns the length of the resulting string after the operations have been applied.
pub fn ops(&self) -> &[Operation][src]
Returns the wrapped sequence of operations.
Trait Implementations
impl Clone for OperationSeq[src]
fn clone(&self) -> OperationSeq[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Debug for OperationSeq[src]
impl Default for OperationSeq[src]
impl FromIterator<Operation> for OperationSeq[src]
fn from_iter<T: IntoIterator<Item = Operation>>(ops: T) -> Self[src]
impl PartialEq<OperationSeq> for OperationSeq[src]
fn eq(&self, other: &OperationSeq) -> bool[src]
fn ne(&self, other: &OperationSeq) -> bool[src]
impl StructuralPartialEq for OperationSeq[src]
Auto Trait Implementations
impl RefUnwindSafe for OperationSeq
impl Send for OperationSeq
impl Sync for OperationSeq
impl Unpin for OperationSeq
impl UnwindSafe for OperationSeq
Blanket Implementations
impl<T> Any for T where
    T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
    T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
    T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
    U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
    T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
    U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, [src]
U: TryFrom<T>,