Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove indirect dependency on ocamlfind #49

Merged
merged 2 commits into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 0.14.1
version = 0.16.0
break-infix = fit-or-vertical
parse-docstrings = true
indicate-multiline-delimiters=no
Expand Down
7 changes: 3 additions & 4 deletions base64.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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}
]
42 changes: 23 additions & 19 deletions src/base64_rfc2045.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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. *)
Expand Down