Packages

Libraries for operational transformations, via a Rust NIF.

Current section

Files

Jump to
ot_ex_rust lib ot text composition.ex
Raw

lib/ot/text/composition.ex

defmodule OT.Text.Composition do
@moduledoc """
The composition of two non-concurrent operations into a single operation.
"""
@doc """
Compose two operations into a single equivalent operation.
The operations are composed in such a way that the resulting operation has the
same effect on document state as applying one operation and then the other:
*S ○ compose(Oa, Ob) = S ○ Oa ○ Ob*.
## Example
iex> OT.Text.Composition.compose(["Bar"], [3])
{:ok, ["Bar"]}
"""
def compose(op_a, op_b) do
Rust.OT.compose(op_a, op_b)
end
@spec compose_many([Operation.t()]) :: {:ok, Operation.t()} | {:error, binary}
def compose_many(ops) do
Rust.OT.compose_many(ops)
end
end