PdfEx.Op (pdf_ex v0.1.0)

Copy Markdown View Source

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

Functions

apply_op(doc, op)

@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}.