package capnp
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=20221b396b17c654e5d0870761bef50c5a5dc99bc578e31980bac76dae1d3560
md5=1c8519640a3e5f06c48220d2194d9d36
doc/capnp.unix/Capnp_unix/IO/ReadContext/index.html
Module IO.ReadContext
val create :
read:('a -> buf:Bytes.t -> pos:int -> len:int -> int) ->
compression:Capnp.Codecs.compression_t ->
'a ->
'a t
create ~read ~compression descr
creates a new context for reading data from the specified descriptor using the specified compression
method.
The semantics of the read
function shall mimic that of Unix.read
, attempting to read into a substring of the buf
and returning the number of bytes actually read. A read of length 0 indicates end-of-file.
val dequeue_message :
'a t ->
Capnp.Message.rw Capnp.Message.BytesMessage.Message.t option
dequeue_message context
attempts to remove a complete message from the incoming queue of the read context
. No data will be read from the underlying descriptor.
val bytes_available : 'a t -> int
bytes_available context
obtains the number of bytes already read which are currently stored in the read context
.
val read : 'a t -> int
read context
attempts to read some data from the underlying descriptor, storing it in the read context
.
val read_message :
'a t ->
Capnp.Message.rw Capnp.Message.BytesMessage.Message.t option
read_message context
attempts to remove a complete message from the incoming queue of the read context
. read
may be invoked repeatedly to provide enough buffered data to decode a complete message.