Collaborative edit operations as plain structs, plus a pure dispatcher.
Each op routes to an existing pure edit function — apply_op/2 adds no state
and no new editing semantics. New ops implement PdfEx.Op.Behaviour and are
dispatched dynamically by struct module, so adding one is a new file rather
than a new clause here. No serialization library: wire encoding is the
consumer's responsibility.
Summary
Functions
Applies an operation to doc by dispatching to the op struct's
PdfEx.Op.Behaviour implementation. Anything that isn't an op struct
implementing the behaviour returns {:error, :unknown_op}.
Types
@type t() :: PdfEx.Op.MoveGlyph.t() | PdfEx.Op.UpdateText.t() | PdfEx.Op.DeleteGlyph.t()
Functions
@spec apply_op(PdfEx.Document.t(), t() | term()) :: {:ok, PdfEx.Document.t()} | {:error, PdfEx.Error.t()}
Applies an operation to doc by dispatching to the op struct's
PdfEx.Op.Behaviour implementation. Anything that isn't an op struct
implementing the behaviour returns {:error, :unknown_op}.