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.



  • 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 Aliases§

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