Module Data_encoding.Binary

type read_error = Data_encoding__V1.Binary.read_error =
  1. | Not_enough_data
  2. | Extra_bytes
  3. | No_case_matched
  4. | Unexpected_tag of int
  5. | Invalid_int of {
    1. min : int;
    2. v : int;
    3. max : int;
    }
  6. | Invalid_float of {
    1. min : float;
    2. v : float;
    3. max : float;
    }
  7. | Trailing_zero
  8. | Size_limit_exceeded
  9. | List_too_long
  10. | Array_too_long
  11. | Exception_raised_in_user_function of string
  12. | User_invariant_guard of string
exception Read_error of read_error
val pp_read_error : Stdlib.Format.formatter -> read_error -> unit
val read_error_encoding : read_error Data_encoding__V1.t
type write_error = Data_encoding__V1.Binary.write_error =
  1. | Size_limit_exceeded
  2. | No_case_matched
  3. | Invalid_int of {
    1. min : int;
    2. v : int;
    3. max : int;
    }
  4. | Invalid_float of {
    1. min : float;
    2. v : float;
    3. max : float;
    }
  5. | Invalid_bytes_length of {
    1. expected : int;
    2. found : int;
    }
  6. | Invalid_string_length of {
    1. expected : int;
    2. found : int;
    }
  7. | Invalid_natural
  8. | List_invalid_length
  9. | Array_invalid_length
  10. | Exception_raised_in_user_function of string
val pp_write_error : Stdlib.Format.formatter -> write_error -> unit
val write_error_encoding : write_error Data_encoding__V1.t
exception Write_error of write_error
val length : 'a Data_encoding__V1.Encoding.t -> 'a -> int
val fixed_length : 'a Data_encoding__V1.Encoding.t -> int option
val maximum_length : 'a Data_encoding__V1.Encoding.t -> int option
val read_opt : 'a Data_encoding__V1.Encoding.t -> string -> int -> int -> (int * 'a) option
val read_exn : 'a Data_encoding__V1.Encoding.t -> string -> int -> int -> int * 'a
type !'ret status = 'ret Data_encoding__V1.Binary.status =
  1. | Await of Stdlib.Bytes.t -> 'ret status
  2. | Error of read_error
val read_stream : ?init:Data_encoding__V1.Binary_stream.t -> 'a Data_encoding__V1.Encoding.t -> 'a status
type writer_state = Data_encoding__V1.Binary.writer_state
val make_writer_state : bytes -> offset:int -> allowed_bytes:int -> writer_state option
val write_opt : 'a Data_encoding__V1.Encoding.t -> 'a -> writer_state -> int option
val write_exn : 'a Data_encoding__V1.Encoding.t -> 'a -> writer_state -> int
val of_bytes_opt : 'a Data_encoding__V1.Encoding.t -> Stdlib.Bytes.t -> 'a option
val of_bytes_exn : 'a Data_encoding__V1.Encoding.t -> Stdlib.Bytes.t -> 'a
val of_string : 'a Data_encoding__V1.Encoding.t -> string -> ('a, read_error) Stdlib.result
val of_string_opt : 'a Data_encoding__V1.Encoding.t -> string -> 'a option
val of_string_exn : 'a Data_encoding__V1.Encoding.t -> string -> 'a
val to_bytes_opt : ?buffer_size:int -> 'a Data_encoding__V1.Encoding.t -> 'a -> Stdlib.Bytes.t option
val to_string : ?buffer_size:int -> 'a Data_encoding__V1.Encoding.t -> 'a -> (string, write_error) Stdlib.result
val to_string_opt : ?buffer_size:int -> 'a Data_encoding__V1.Encoding.t -> 'a -> string option
val to_string_exn : ?buffer_size:int -> 'a Data_encoding__V1.Encoding.t -> 'a -> string
val describe : 'a Data_encoding__V1.Encoding.t -> Data_encoding__V1.Binary_schema.t
module Slicer : sig ... end
val read : 'a Data_encoding__V1.Encoding.t -> bytes -> int -> int -> (int * 'a) option
val write : 'a Data_encoding__V1.Encoding.t -> 'b -> bytes -> int -> int -> int option
val of_bytes : 'a Data_encoding__V1.Encoding.t -> Stdlib.Bytes.t -> 'b option
val to_bytes : 'a Data_encoding__V1.Encoding.t -> 'b -> Stdlib.Bytes.t option
val to_bytes_exn : 'a Data_encoding__V1.Encoding.t -> 'b -> Stdlib.Bytes.t