pub struct Packed4SliceMut<'a, T>where
T: Packable4,{ /* private fields */ }Expand description
A mutable view over a packed slice of 4-bit values, stored 2 per byte.
Implementations§
Source§impl<'a, T> Packed4SliceMut<'a, T>where
T: Packable4,
impl<'a, T> Packed4SliceMut<'a, T>where
T: Packable4,
Sourcepub fn new(data: &'a mut [u8], len: usize) -> Option<Packed4SliceMut<'a, T>>
pub fn new(data: &'a mut [u8], len: usize) -> Option<Packed4SliceMut<'a, T>>
Create a new Packed4SliceMut from packed bytes and logical length.
Returns None if the backing buffer is too small for the requested length.
Sourcepub fn as_packed_slice(&self) -> &[u8] ⓘ
pub fn as_packed_slice(&self) -> &[u8] ⓘ
Returns the underlying packed byte slice.
Sourcepub fn as_packed_slice_mut(&mut self) -> &mut [u8] ⓘ
pub fn as_packed_slice_mut(&mut self) -> &mut [u8] ⓘ
Returns the underlying mutable packed byte slice.
Sourcepub fn as_borrowed(&self) -> Packed4Slice<'_, T>
pub fn as_borrowed(&self) -> Packed4Slice<'_, T>
Return a borrowed read-only view of this mutable packed slice.
Sourcepub fn sub_slice_mut(
self,
range: Range<usize>,
) -> Option<Packed4SliceMut<'a, T>>
pub fn sub_slice_mut( self, range: Range<usize>, ) -> Option<Packed4SliceMut<'a, T>>
Attempts to create a zero-copy mutable sub-slice of the packed slice.
This is only possible without allocation if the range starts at an even logical index
(aligned to byte boundaries). If the range starts at an odd index, returns None.
Auto Trait Implementations§
impl<'a, T> !UnwindSafe for Packed4SliceMut<'a, T>
impl<'a, T> Freeze for Packed4SliceMut<'a, T>
impl<'a, T> RefUnwindSafe for Packed4SliceMut<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Packed4SliceMut<'a, T>where
T: Send,
impl<'a, T> Sync for Packed4SliceMut<'a, T>where
T: Sync,
impl<'a, T> Unpin for Packed4SliceMut<'a, T>where
T: Unpin,
impl<'a, T> UnsafeUnpin for Packed4SliceMut<'a, T>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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