diff --git a/.ocamlformat b/.ocamlformat index 71d5f8a..f57d502 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,4 +1,4 @@ -version = 0.14.1 +version = 0.16.0 break-infix = fit-or-vertical parse-docstrings = true indicate-multiline-delimiters=no diff --git a/base64.opam b/base64.opam index ee7a9c6..fbb0532 100644 --- a/base64.opam +++ b/base64.opam @@ -15,15 +15,14 @@ binary data in an ASCII string format by translating it into a radix-64 representation. It is specified in RFC 4648. """ depends: [ - "ocaml" {>="4.03.0"} - "base-bytes" + "ocaml" {>= "4.03.0"} "dune" {>= "2.0"} "bos" {with-test} "rresult" {with-test} "alcotest" {with-test} ] build: [ - ["dune" "subst"] + ["dune" "subst"] {dev} ["dune" "build" "-p" name "-j" jobs] - ["dune" "runtest" "-p" name] {with-test} + ["dune" "runtest" "-p" name "-j" jobs] {with-test} ] diff --git a/src/base64_rfc2045.mli b/src/base64_rfc2045.mli index 90fef82..0e4d9ad 100644 --- a/src/base64_rfc2045.mli +++ b/src/base64_rfc2045.mli @@ -39,18 +39,21 @@ val decoder : src -> decoder (** [decoder src] is a decoder that inputs from [src]. *) val decode : decoder -> decode -(** [decode d] is: {ul {- [`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 base64 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.} - {- [`Flush data] if a [data] sequence value was decoded.} {- - [`Wrong_padding] if decoder retrieve a wrong padding at the end of the - input.}} - - {b Note}. Repeated invocation always eventually returns [`End], even in - case of errors. *) +(** [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 base64 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. + - [`Flush data] if a [data] sequence value was decoded. + - [`Wrong_padding] if decoder retrieve a wrong padding at the end of the + input. + + {b 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] @@ -79,19 +82,20 @@ val encoder : dst -> encoder (** [encoder dst] is an encoder for Base64 (RFC2045) that outputs to [dst]. *) val encode : encoder -> encode -> [ `Ok | `Partial ] -(** [encode e v]: is {ul {- [`Partial] iff [e] has a [`Manual] destination and - needs more output storage. The client must use {!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 [`Char] or - [`End]}} +(** [encode e v]: is + + - [`Partial] iff [e] has a [`Manual] destination and needs more output + storage. The client must use {!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 [`Char] or [`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 size of the last provided buffer (i.e. nothing was written). - {b Raises.} [Invalid_argument] if a [`Char] or [`End] is - encoded after a [`Partial] encode. *) + {b Raises.} [Invalid_argument] if a [`Char] or [`End] is encoded after a + [`Partial] encode. *) val encoder_dst : encoder -> dst (** [encoder_dst encoder] is [encoder]'s output destination. *)