package pecu
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=5a2c1cf11c9dcf29704a1678cd1f4aa1bb0555f2277744aa3763e64ad188c996
sha512=019a64ba3dfed4a2ce3e29a01c842c4be2c02f79700d0dd31ff98db23190b35dbf5b413c3eb2358126925f5a1badf10cfdff3634aef9a920f8860c42c15995bf
doc/pecu/Pecu/index.html
Module PecuSource
Decode
The type for decoders.
The type for input sources. With a `Manual source the client must provide input with src.
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.
decode d is:
`Awaitifdhas a`Manualinput source and awaits for more input. The client must usesrcto provide it.`Endif the end of input was reached.`Malformed bytesif thebytessequence 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 dataif adatasequence value was decoded.`Line lineif aline sequence value plus a line-break was decoded.
Note. Repeated invocation always eventually returns `End, even in case of errors.
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.
decoder_dangerous d returns true if encoded input does not respect the 80-columns rule. In this case, internal buffers can grow automatically. If you are interested in a best-effort decoding you can still continue to decode even if decoder_dangerous d returns true. However, it could be an attack entry point in a server-context.
Encode
The type for output destinations. With a `Manual destination the client must provide output storage with dst.
The type for Quoted-Printable encoder.
encoder dst is an encoder for quoted-printable that outputs to dst.
encode e v: is
`Partialiffehas a`Manualdestination and needs more output storage. The client must usedstto provide a new buffer and then callencodewith`Awaituntil`Okis returned.`Okwhen the encoder is ready to encode a new`Char,`Line_breakor`End
For `Manual destination, encoding `End always return `Partial, the client should continue as usual with `Await until `Ok is returned at which point dst_rem encoder is guaranteed to be the sode of the last provided buffer (i.e. nothing was written).
Raises. Invalid_argument if a `Char, `Line_break or `End is encoded after a `Partial encode.