package lwt-binio

  1. Overview
  2. Docs
type src_t
val read : src_t -> size:int -> offset:int -> get:(Stdlib.Bytes.t -> int -> 'a) -> conv:('a -> 'b) -> 'b option Lwt.t
val write : src_t -> 'a -> size:int -> offset:int -> set:(Stdlib.Bytes.t -> int -> 'b -> 'c) -> conv:('a -> 'b) -> unit Lwt.t

Arbitrary value IO

val four_byte : (int32 -> 'a) -> ('b -> int32) -> (src_t -> int -> 'a option Lwt.t) * (src_t -> int -> 'b -> unit Lwt.t)
val eight_byte : (int64 -> 'a) -> ('b -> int64) -> (src_t -> int -> 'a option Lwt.t) * (src_t -> int -> 'b -> unit Lwt.t)

Reading and writing values of a specific size

val read_float32 : src_t -> int -> float option Lwt.t
val write_float32 : src_t -> int -> float -> unit Lwt.t
val read_int32 : src_t -> int -> int32 option Lwt.t
val write_int32 : src_t -> int -> int32 -> unit Lwt.t
val read_float64 : src_t -> int -> float option Lwt.t
val write_float64 : src_t -> int -> float -> unit Lwt.t
val read_int64 : src_t -> int -> int64 option Lwt.t
val write_int64 : src_t -> int -> int64 -> unit Lwt.t

read_* src index and write_* src index x for numeric types

OCaml

Innovation. Community. Security.