package bare_encoding

  1. Overview
  2. Docs

Module Bare_encodingSource

BARE runtime library.

See the spec.

Sourcemodule String_map : sig ... end
Sourcemodule type INPUT = sig ... end

Input type.

Sourcetype input = (module INPUT)
Sourcemodule Decode : sig ... end

Decoders.

Sourcemodule type OUTPUT = sig ... end

Output

Sourcetype output = (module OUTPUT)
Sourcemodule Encode : sig ... end

Encoder type and some encoding utils.

Sourcemodule Pp : sig ... end

Pretty printer utils, using Format.

Sourceval of_bytes_exn : ?off:int -> ?len:int -> 'a Decode.dec -> bytes -> 'a

of_bytes_exn dec bs uses dec to decode a value of type 'a from bytes stored in bs.

  • parameter off

    the initial offset in bs (default 0)

  • raises Decode.Error

    if decoding fails

Sourceval of_bytes : ?off:int -> ?len:int -> 'a Decode.dec -> bytes -> ('a, string) result

Same as of_bytes_exn but doesn't raise.

Sourceval of_string_exn : ?off:int -> ?len:int -> 'a Decode.dec -> string -> 'a

Decode a value stored in the string. See of_bytes_exn for more details.

  • raises Decode.Error

    if decoding fails

Sourceval of_string : ?off:int -> ?len:int -> 'a Decode.dec -> string -> ('a, string) result

Safe version of of_string_exn

Sourceval to_string : 'a Encode.enc -> 'a -> string

Encode a value of type 'a into a string using the given encoder.

OCaml

Innovation. Community. Security.