package bare_encoding

  1. Overview
  2. Docs

Module Bare_encoding.DecodeSource

Decoders.

This module provides a decoder type Decode.t to hold the decoding state, along with functions to decode specific primitives.

Sourcetype t
Sourceval of_input : input -> t

create input makes a decoder for the given input.

  • since 0.2
Sourceval of_string : ?off:int -> ?len:int -> string -> t

Decoder reading from the string.

  • parameter off

    initial offset in the string

  • parameter len

    length of the slice of the string

  • raises Invalid_arg

    if off,off+len is not a valid slice in the string.

  • since 0.2
Sourceval of_bytes : ?off:int -> ?len:int -> bytes -> t

See of_string

  • since 0.2
Sourcetype 'a dec = t -> 'a

A decoder for values of type 'a. Decoders will raise Error to indicate failure.

Sourceval uint : t -> int64

Decode a varint-encoded unsigned integer

Sourceval int : t -> int64

Decode a varint-encoded integer

Sourceval u8 : t -> char
Sourceval u16 : t -> int
Sourceval u32 : t -> int32
Sourceval u64 : t -> int64
Sourceval i8 : t -> char
Sourceval i16 : t -> int
Sourceval i32 : t -> int32
Sourceval i64 : t -> int64
Sourceval bool : t -> bool
Sourceval f32 : t -> float
Sourceval f64 : t -> float
Sourceval string : t -> string
Sourceval data : t -> bytes
Sourceval data_of : size:int -> t -> bytes
Sourceval optional : 'a dec -> 'a option dec
OCaml

Innovation. Community. Security.