Module Bin_prot_utils_eio

Eio-based alternatives to Chatgpt.Bin_prot_utils. All functions that previously took a file name now take an Eio.Path.t rooted at some directory capability (typically Eio.Stdenv.cwd or Eio.Stdenv.fs).

val grow_buffer : Core.Bigstring.t -> new_size_request:int -> Core.Bigstring.t

Grow a bigstring buffer.

Low-level helpers

val append_bin_list_to_file : path -> 'a Core.Bin_prot.Type_class.writer -> 'a list -> unit
val write_bin_prot' : path -> 'a Core.Bin_prot.Type_class.writer -> 'a -> unit
val read_bin_prot' : path -> 'a Core.Bin_prot.Type_class.reader -> 'a
val fold_bin_file_list : path -> 'a Core.Bin_prot.Type_class.reader -> init:'b -> f:('b -> 'a -> 'b) -> 'b
val read_bin_file_list : path -> 'a Core.Bin_prot.Type_class.reader -> 'a list
val iter_bin_file_list : f:('a -> unit) -> path -> 'a Core.Bin_prot.Type_class.reader -> unit
val map_bin_file_list : f:('a -> 'b) -> path -> 'a Core.Bin_prot.Type_class.reader -> 'b list

Helpers parameterised by a Binable module

val write_bin_prot : (module Core.Bin_prot.Binable.S with type t = 'a) -> path -> 'a -> unit
val read_bin_prot : (module Core.Bin_prot.Binable.S with type t = 'a) -> path -> 'a
val write_bin_prot_list : (module Core.Bin_prot.Binable.S with type t = 'a) -> path -> 'a list -> unit
val read_bin_prot_list : (module Core.Bin_prot.Binable.S with type t = 'a) -> path -> 'a list
val iter_bin_prot_list : (module Core.Bin_prot.Binable.S with type t = 'a) -> path -> f:('a -> unit) -> unit
val fold_bin_prot_list : (module Core.Bin_prot.Binable.S with type t = 'a) -> path -> init:'b -> f:('b -> 'a -> 'b) -> 'b
val map_bin_prot_list : (module Core.Bin_prot.Binable.S with type t = 'a) -> path -> f:('a -> 'b) -> 'b list

Convenience functor