pub struct Accessor<B, T> { /* private fields */ }Expand description
A tool for converting zerocopy’s Ref<_, T>s into &T/&mut T
based on need and input B mutability.
This primarily reduces pointer sizes for fixed-width packet parts as
an internal component of all Valid packets.
Zerocopy issue #368
would obviate the need for this, but I do not believe it is under active
development. It would also open us back up to allowing any B rather than
simply those which are IntoByteSlice.
Implementations§
Source§impl<B: SplitByteSlice, T: FromBytes + IntoBytes + KnownLayout + Immutable> Accessor<B, T>
impl<B: SplitByteSlice, T: FromBytes + IntoBytes + KnownLayout + Immutable> Accessor<B, T>
Sourcepub fn read_from_prefix<'a>(buf: B) -> Result<(Self, B), ParseError>where
B: 'a + IntoBufPointer<'a>,
T: 'a,
pub fn read_from_prefix<'a>(buf: B) -> Result<(Self, B), ParseError>where
B: 'a + IntoBufPointer<'a>,
T: 'a,
Parses out a fixed-width packet chunk T from the start of a given
buffer.
Trait Implementations§
Auto Trait Implementations§
impl<B, T> Freeze for Accessor<B, T>
impl<B, T> RefUnwindSafe for Accessor<B, T>where
T: RefUnwindSafe,
B: RefUnwindSafe,
impl<B, T> !Send for Accessor<B, T>
impl<B, T> !Sync for Accessor<B, T>
impl<B, T> Unpin for Accessor<B, T>where
B: Unpin,
impl<B, T> UnwindSafe for Accessor<B, T>where
T: RefUnwindSafe,
B: 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