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§
Source§impl<T: Deref<Target = [u8]>> ReaderSegments for BufferSegments<T>
Available on crate feature alloc only.
impl<T: Deref<Target = [u8]>> ReaderSegments for BufferSegments<T>
Available on crate feature
alloc only.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> UnsafeUnpin for BufferSegments<T>where
T: UnsafeUnpin,
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