module Bigstring_marshal: Bigstring_marshal
Marshalling to/from bigstrings
val marshal_blit : ?flags:Marshal.extern_flags list ->
'a -> ?pos:int -> ?len:int -> Bigstring.t -> int
marshal_blit ?flags v ?pos ?len buf
marshals value
v
to bigstring
buf
starting at position
pos
and at most
len
bytes.
RaisesInvalid_argument
if the designated range is out of bounds.
Failure
if buf
cannot hold enough data for marshalling.
flags
: default = []
pos
: default = 0
len
: default = length buf - pos
val marshal : ?flags:Marshal.extern_flags list -> 'a -> Bigstring.t
marshal ?flags v
marshals value v
to a bigstring using marshalling
flags flags
. This function may need two times more memory than
marshal_blit
.
flags
: default = []
val marshal_data_size : ?pos:int -> Bigstring.t -> int
marshal_data_size ?pos buf
Raises Invalid_argument
if the position is out of bounds considering
a valid marshal header.
Returns the length of marshalled data in
bigstring buf
starting at position pos
.
pos
: default = 0
val unmarshal : ?pos:int -> Bigstring.t -> 'a
unmarshal ?pos buf
unmarshals data contained in buf
starting
at position pos
.
Raises Invalid_argument
if the position is out of bounds, or if
there is not enough data for unmarshalling.
pos
: default = 0
val unmarshal_next : ?pos:int -> Bigstring.t -> 'a * int
unmarshal_next ?pos buf
unmarshals data contained in buf
starting
at position pos
.
Raises Invalid_argument
if the position is out of bounds, or if
there is not enough data for unmarshalling.
Returns (v, next_pos)
, where v
is the
unmarshalled value, and next_pos
designates the start of the byte
following the unmarshalled data.
pos
: default = 0
val skip : ?pos:int -> Bigstring.t -> int
skip ?pos buf
skips the marshalled data starting at position pos
.
Raises Invalid_argument
if the position is out of bounds, or if
there is not enough data for unmarshalling.
Returns the start of the byte following the unmarshalled data.
pos
: default = 0