pub struct OperationSeq { /* private fields */ }
Expand description

A sequence of Operations on text.

Implementations

Creates a store for operatations which does not need to allocate until capacity operations have been stored inside.

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.

Deletes n characters at the current cursor position.

Inserts a s at the current cursor position.

Moves the cursor n characters forwards.

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.

Applies an operation to a string, returning a new string.

Error

Returns an error if the operation cannot be applied due to length conflicts.

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.

Checks if this operation has no effect.

Returns the length of a string these operations can be applied to

Returns the length of the resulting string after the operations have been applied.

Returns the wrapped sequence of operations.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Creates a value from an iterator. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.