Module Bigstring_marshal

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.
Raises
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
val marshal_to_fd : ?buf:Bigstring.t ->
?flags:Marshal.extern_flags list -> Unix.file_descr -> 'a -> unit
marshal_to_fd ?buf fd v marshals data v to file descriptor fd using marshalling buffer buf, and marshalling flags flags. Raises input errors as in Bigstring.really_write.
Raises Failure if buf cannot hold enough data for marshalling.
buf : default = determined dynamically
flags : default = []
val marshal_to_sock_no_sigpipe : (?buf:Bigstring.t ->
?flags:Marshal.extern_flags list -> Unix.file_descr -> 'a -> unit)
Or_error.t
marshal_to_sock_no_sigpipe ?buf sock v same as Bigstring_marshal.marshal_to_fd, but writes to sockets only and uses Bigstring.really_send_no_sigpipe to avoid SIGPIPE on sockets.
val unmarshal_from_sock : ?buf:Bigstring.t -> Unix.file_descr -> 'a
unmarshal_from_sock ?buf sock unmarshals data from socket sock using unmarshalling buffer buf. Raises input errors as in Bigstring.really_recv.
Raises Failure if buf cannot hold enough data for unmarshalling.
buf : default = determined dynamically