Module type
Class type
type src =
  1. | Channel of in_channel
  2. | String of string
  3. | Manual

    The type for input sources.

type error =
  1. | Header_invalid of string
  2. | Eof of string

    The type for errors.

val pp_error : Format.formatter -> error -> unit
type t

The type for decoders.

val make : src -> t

decoder src is a decoder that inputs from src.

type decode_result =
  1. | R of R.t
  2. | Await
  3. | End
  4. | Error of error
val decode : t -> decode_result

decode d is:

  • `Await iff d has a `Manual input source and awaits for more input. The client must use Manual.src to provide it.
  • `R r, if a record r was decoded.
  • `End, if the end of input was reached.
  • `Error, if an error occured. If you are interested in a best-effort decoding you can still continue to decode after an error.

Note. Repeated invocation always eventually returns `End, even in case of errors.

module Manual : sig ... end

Manual sources.