Module type
Class type
type dst =
  1. | Channel of out_channel
  2. | Buffer of Buffer.t
  3. | Manual

    The type for output destinations.

type t

The type for R encoders.

val make : dst -> t

encoder dst is an encoder that outputs to dst.

type encode =
  1. | Await
  2. | End
  3. | R of R.t
val encode : t -> encode -> [ `Ok | `Partial ]

encode e v is :

  • `Partial iff e has a `Manual destination and needs more output storage. The client must use Manual.dst to provide a new buffer and then call encode with `Await until `Ok is returned.
  • `Ok when the encoder is ready to encode a new `R or `End.

For `Manual destinations, encoding `End always returns `Partial, continue with `Await until `Ok is returned at which point Manual.dst_rem e is guaranteed to be the size of the last provided buffer (i.e. nothing was written).

Raises. Invalid_argument if a non well-formed sequence of lexemes is encoded or if a `Lexeme or `End is encoded after a `Partial encode.

module Manual : sig ... end

Manual destinations.