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 performed by 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<Self>
pub fn new(buffer: T, options: ReaderOptions) -> Result<Self>
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).
pub fn into_buffer(self) -> T
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for BufferSegments<T>where
T: Freeze,
impl<T> RefUnwindSafe for BufferSegments<T>where
T: RefUnwindSafe,
impl<T> Send for BufferSegments<T>where
T: Send,
impl<T> Sync for BufferSegments<T>where
T: Sync,
impl<T> Unpin for BufferSegments<T>where
T: Unpin,
impl<T> UnwindSafe for BufferSegments<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more