pub struct SliceBufViewMut<'a>(/* private fields */);
Expand description
A BufferViewMut
into a &mut [u8]
.
This type is useful for instantiating a mutable view into a slice that can be used for parsing, where any parsing that is done only affects this view and therefore need not be “undone” later.
Note that BufferViewMut<&mut [u8]>
is also implemented for &mut &mut u8
(a mutable reference to a mutable byte slice), but this can be problematic
if you need to materialize an owned type that implements BufferViewMut
,
in order to pass it to a function, for example, so that it does not hold a
reference to a temporary value.
Implementations§
Trait Implementations§
Source§impl<'a> AsMut<[u8]> for SliceBufViewMut<'a>
impl<'a> AsMut<[u8]> for SliceBufViewMut<'a>
Source§impl<'a> AsRef<[u8]> for SliceBufViewMut<'a>
impl<'a> AsRef<[u8]> for SliceBufViewMut<'a>
Source§impl<'a> BufferView<&'a mut [u8]> for SliceBufViewMut<'a>
impl<'a> BufferView<&'a mut [u8]> for SliceBufViewMut<'a>
Source§fn take_front(&mut self, n: usize) -> Option<&'a mut [u8]>
fn take_front(&mut self, n: usize) -> Option<&'a mut [u8]>
Takes
n
bytes from the front of the buffer’s body. Read moreSource§fn take_back(&mut self, n: usize) -> Option<&'a mut [u8]>
fn take_back(&mut self, n: usize) -> Option<&'a mut [u8]>
Takes
n
bytes from the back of the buffer’s body. Read moreSource§fn into_rest(self) -> &'a mut [u8] ⓘ
fn into_rest(self) -> &'a mut [u8] ⓘ
Converts this view into a reference to the buffer’s body. Read more
Source§fn take_rest_front(&mut self) -> B
fn take_rest_front(&mut self) -> B
Takes the rest of the buffer’s body from the front. Read more
Source§fn take_rest_back(&mut self) -> B
fn take_rest_back(&mut self) -> B
Takes the rest of the buffer’s body from the back. Read more
Source§fn take_byte_front(&mut self) -> Option<u8>
fn take_byte_front(&mut self) -> Option<u8>
Takes a single byte of the buffer’s body from the front. Read more
Source§fn take_byte_back(&mut self) -> Option<u8>
fn take_byte_back(&mut self) -> Option<u8>
Takes a single byte of the buffer’s body from the back. Read more
Source§fn peek_obj_front<T>(&mut self) -> Option<&T>where
T: FromBytes + KnownLayout + Immutable + Unaligned,
fn peek_obj_front<T>(&mut self) -> Option<&T>where
T: FromBytes + KnownLayout + Immutable + Unaligned,
Peeks at an object at the front of the buffer’s body. Read more
Source§fn take_obj_front<T>(&mut self) -> Option<Ref<B, T>>where
T: KnownLayout + Immutable + Unaligned,
fn take_obj_front<T>(&mut self) -> Option<Ref<B, T>>where
T: KnownLayout + Immutable + Unaligned,
Takes an object from the front of the buffer’s body. Read more
Source§fn take_slice_front<T>(&mut self, n: usize) -> Option<Ref<B, [T]>>where
T: Immutable + Unaligned,
fn take_slice_front<T>(&mut self, n: usize) -> Option<Ref<B, [T]>>where
T: Immutable + Unaligned,
Takes a slice of objects from the front of the buffer’s body. Read more
Source§fn peek_obj_back<T>(&mut self) -> Option<&T>where
T: FromBytes + KnownLayout + Immutable + Unaligned,
fn peek_obj_back<T>(&mut self) -> Option<&T>where
T: FromBytes + KnownLayout + Immutable + Unaligned,
Peeks at an object at the back of the buffer’s body. Read more
Source§fn take_obj_back<T>(&mut self) -> Option<Ref<B, T>>where
T: Immutable + KnownLayout + Unaligned,
fn take_obj_back<T>(&mut self) -> Option<Ref<B, T>>where
T: Immutable + KnownLayout + Unaligned,
Takes an object from the back of the buffer’s body. Read more
Source§impl<'a> BufferViewMut<&'a mut [u8]> for SliceBufViewMut<'a>
impl<'a> BufferViewMut<&'a mut [u8]> for SliceBufViewMut<'a>
Source§fn take_front_zero(&mut self, n: usize) -> Option<B>
fn take_front_zero(&mut self, n: usize) -> Option<B>
Takes
n
bytes from the front of the buffer’s body and zeroes them. Read moreSource§fn take_back_zero(&mut self, n: usize) -> Option<B>
fn take_back_zero(&mut self, n: usize) -> Option<B>
Takes
n
bytes from the back of the buffer’s body and zeroes them. Read moreSource§fn take_rest_front_zero(self) -> B
fn take_rest_front_zero(self) -> B
Takes the rest of the buffer’s body from the front and zeroes it. Read more
Source§fn take_rest_back_zero(self) -> B
fn take_rest_back_zero(self) -> B
Takes the rest of the buffer’s body from the back and zeroes it. Read more
Source§fn into_rest_zero(self) -> B
fn into_rest_zero(self) -> B
Converts this view into a reference to the buffer’s body, and zeroes it. Read more
Source§fn take_obj_front_zero<T>(&mut self) -> Option<Ref<B, T>>where
T: KnownLayout + Immutable + Unaligned,
fn take_obj_front_zero<T>(&mut self) -> Option<Ref<B, T>>where
T: KnownLayout + Immutable + Unaligned,
Takes an object from the front of the buffer’s body and zeroes it. Read more
Source§fn take_obj_back_zero<T>(&mut self) -> Option<Ref<B, T>>where
T: KnownLayout + Immutable + Unaligned,
fn take_obj_back_zero<T>(&mut self) -> Option<Ref<B, T>>where
T: KnownLayout + Immutable + Unaligned,
Takes an object from the back of the buffer’s body and zeroes it. Read more
Auto Trait Implementations§
impl<'a> Freeze for SliceBufViewMut<'a>
impl<'a> RefUnwindSafe for SliceBufViewMut<'a>
impl<'a> Send for SliceBufViewMut<'a>
impl<'a> Sync for SliceBufViewMut<'a>
impl<'a> Unpin for SliceBufViewMut<'a>
impl<'a> !UnwindSafe for SliceBufViewMut<'a>
Blanket Implementations§
Source§impl<O, B> AsFragmentedByteSlice<B> for O
impl<O, B> AsFragmentedByteSlice<B> for O
Source§fn as_fragmented_byte_slice(&mut self) -> FragmentedByteSlice<'_, B>
fn as_fragmented_byte_slice(&mut self) -> FragmentedByteSlice<'_, B>
Generates a
FragmentedByteSlice
view of self
.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