package capnp

  1. Overview
  2. Docs
OCaml code generation plugin for the Cap'n Proto serialization framework

Install

Dune Dependency

Authors

Maintainers

Sources

capnp-v3.4.0.tbz
sha256=7a6b0e4dbbe6d246336f248c69f719fd372bb8d51805822ea123983c3181c17e
sha512=d8ecf1d6481edab02fd8cc7dc269ee0c357a1858f4434adacdd1f2af9d528c7304e3e467faa1273ebb8f6a452b80b5822cbddfcc4534229bd0edca24a70a5833

doc/capnp.unix/Capnp_unix/IO/ReadContext/index.html

Module IO.ReadContextSource

Sourcetype 'a t
Sourceval 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.

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.

  • returns

    None if there is insufficient data stored in the read context to decode a complete message

  • raises Unsupported_message_frame

    if the frame header describes a segment count or segment size that is too large for the implementation

Sourceval bytes_available : 'a t -> int

bytes_available context obtains the number of bytes already read which are currently stored in the read context.

Sourceval read : 'a t -> int

read context attempts to read some data from the underlying descriptor, storing it in the read context.

  • returns

    the number of bytes actually read

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.

  • returns

    None if end-of-file was reached before a complete message could be read

  • raises Unsupported_message_frame

    if the frame header describes a segment count or segment size that is too large for the implementation

OCaml

Innovation. Community. Security.