package pecu

  1. Overview
  2. Docs
Module type
Class type

Decode inline quoted-printable value

type decoder

The type for decoders.

type decode = [
  1. | `Await
  2. | `End
  3. | `Char of char
  4. | `Malformed of string
val src : decoder -> Stdlib.Bytes.t -> int -> int -> unit

src d s j l provides d with l bytes to read, starting at j in s. This byte range is read by calls to decode with d until `Await is returned. To signal the end of input, call the function with l = 0.

val decoder : src -> decoder

decoder src is a decoder that inputs from src.

val decode : decoder -> decode

decode d is:

  • `Await if d has a `Manual input source and awaits for more input. The client must use src to provide it.
  • `End if the end of input was reached.
  • `Malformed bytes if the bytes sequence is malformed according to the decoded quoted-printable encoding scheme. If you are interested in a best-effort decoding you can still continue to decode after an error until the decode synchronizes again on valid bytes.
  • `Data data if a data sequence value was decoded.
  • `Line line if a line sequence value plus a line-break was decoded.

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

val decoder_byte_count : decoder -> int

decoder_byte_count d is the number of characters already decoded on d (included malformed ones). This is the last decode's end output offset counting from beginning of the stream.

val decoder_src : decoder -> src

decoder_src d is d's input source.

type dst = [
  1. | `Channel of Stdlib.out_channel
  2. | `Buffer of Stdlib.Buffer.t
  3. | `Manual
type encode = [
  1. | `Await
  2. | `End
  3. | `Char of char
type encoder
val encoder : dst -> encoder
val encode : encoder -> encode -> [ `Ok | `Partial ]
val encoder_dst : encoder -> dst
val dst : encoder -> Stdlib.Bytes.t -> int -> int -> unit
val dst_rem : encoder -> int