pub trait ReaderSegments {
    fn get_segment(&self, idx: u32) -> Option<&[u8]>;

    fn len(&self) -> usize { ... }
}
Expand description

An object that manages the buffers underlying a Cap’n Proto message reader.

Required Methods

Gets the segment with index idx. Returns None if idx is out of range.

The segment must be 8-byte aligned or the “unaligned” feature must be enabled in the capnp crate. (Otherwise reading the segment will return an error.)

The returned slice is required to point to memory that remains valid until the ReaderSegments object is dropped. In safe Rust, it should not be possible to violate this requirement.

Provided Methods

Gets the number of segments.

Implementations on Foreign Types

Implementors