Crate capnp

source ·
Expand description

Cap’n Proto Runtime Library

This crate contains basic facilities for reading and writing Cap’n Proto messages in Rust. It is intended to be used in conjunction with code generated by the capnpc-rust crate.


Dynamically typed value.
List of AnyPointers.
Hooks for for the RPC system.
List of capabilities.
Helper type for generated Struct and List constants.
Sequence of bytes.
List of sequences of bytes.
List of enums.
Custom I/O traits that roughly mirror std::io::{Read, BufRead, Write}. This extra layer of indirection enables support of no-std environments.
List of lists.
Untyped root container for a Cap’n Proto value.
List of primitives.
Implementation details that should never be directly used by clients.
Functions providing low level access to encoded data.
Reading and writing of messages using the standard stream framing, where each message is preceded by a segment table indicating the size of its segments.
Reading and writing of messages using the packed stream encoding.
List of structs.
UTF-8 encoded text.
List of strings containing UTF-8 encoded text.


Describes an arbitrary error that prevented an operation from completing.
Size of a message. Every generated struct has a method .total_size() that returns this.
An enum value or union discriminant that was not found among those defined in a schema.
8 bytes, aligned to an 8-byte boundary.


The general nature of an error. The purpose of this enum is not to describe the error itself, but rather to describe how the client might want to respond to the error.
Helper struct that allows MessageBuilder::get_segments_for_output() to avoid heap allocations in the single-segment case.


Constructs a word with the given bytes.

Type Definitions

Because messages are lazily validated, the return type of any method that reads a pointer field must be wrapped in a Result.