package bare_encoding

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

BARE runtime library.

See the spec.

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

Input type.

type input = (module INPUT)
module Decode : sig ... end

Decoders.

module type OUTPUT = sig ... end

Output

type output = (module OUTPUT)
module Encode : sig ... end

Encoder type and some encoding utils.

module Pp : sig ... end

Pretty printer utils, using Format.

val 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

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

Same as of_bytes_exn but doesn't raise.

val 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

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

Safe version of of_string_exn

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

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

OCaml

Innovation. Community. Security.