pub struct DecoderBufferMut<'a> { /* private fields */ }Expand description
A BPF-aware version of s2n_codec::DecoderBufferMut
The Linux BPF verifier requires that every pointer be checked against the end pointer. This
means that it struggles with regular Rust slices that use ptr + len instead of ptr + end.
Implementations§
Source§impl<'a> DecoderBufferMut<'a>
impl<'a> DecoderBufferMut<'a>
Sourcepub unsafe fn new(start: *mut u8, end: *mut u8) -> Self
pub unsafe fn new(start: *mut u8, end: *mut u8) -> Self
Creates a new DecoderBufferMut.
§Safety
The start and end pointers must be a valid range of bytes, ideally directly coming
from the BPF/XDP context argument.
Sourcepub fn decode<T: DecoderValueMut<'a>>(self) -> Result<(T, Self), DecoderError>
pub fn decode<T: DecoderValueMut<'a>>(self) -> Result<(T, Self), DecoderError>
Decodes a T from the buffer, if possible
Sourcepub fn decode_slice(self, len: usize) -> Result<(Self, Self), DecoderError>
pub fn decode_slice(self, len: usize) -> Result<(Self, Self), DecoderError>
Decodes a slice of bytes with the given len, if possible
pub fn into_less_safe_slice(self) -> &'a mut [u8] ⓘ
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<'a> Decoder<'a> for DecoderBufferMut<'a>
impl<'a> Decoder<'a> for DecoderBufferMut<'a>
fn decode<T: DecoderValue<'a> + DecoderValueMut<'a>>( self, ) -> Result<(T, Self), DecoderError>
fn decode_slice(self, len: usize) -> Result<(Self, Self), DecoderError>
Auto Trait Implementations§
impl<'a> Freeze for DecoderBufferMut<'a>
impl<'a> RefUnwindSafe for DecoderBufferMut<'a>
impl<'a> !Send for DecoderBufferMut<'a>
impl<'a> !Sync for DecoderBufferMut<'a>
impl<'a> Unpin for DecoderBufferMut<'a>
impl<'a> !UnwindSafe for DecoderBufferMut<'a>
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