Struct capnp::serialize::BufferSegments
source · pub struct BufferSegments<T> { /* private fields */ }
Expand description
Segments read from a buffer, useful for when you have the message in a buffer and don’t want the extra
copy of read_message
.
Implementations§
source§impl<T: Deref<Target = [u8]>> BufferSegments<T>
impl<T: Deref<Target = [u8]>> BufferSegments<T>
sourcepub fn new(buffer: T, options: ReaderOptions) -> Result<BufferSegments<T>>
pub fn new(buffer: T, options: ReaderOptions) -> Result<BufferSegments<T>>
Reads a serialized message (including a segment table) from a buffer and takes ownership, without copying.
The buffer is allowed to be longer than the message. Provide this to Reader::new
with options that make
sense for your use case. Very long lived mmaps may need unlimited traversal limit.
ALIGNMENT: If the “unaligned” feature is enabled, then there are no alignment requirements on buffer
.
Otherwise, buffer
must be 8-byte aligned (attempts to read the message will trigger errors).