pub struct SliceMutUnchecked<'a, T> { /* private fields */ }Expand description
Implementations§
Source§impl<'a, T> SliceMutUnchecked<'a, T>
impl<'a, T> SliceMutUnchecked<'a, T>
Sourcepub const unsafe fn new(buf: &'a mut [T]) -> Self
pub const unsafe fn new(buf: &'a mut [T]) -> Self
Create a new SliceMutUnchecked from the given slice.
§Safety
SliceMutUnchecked’s implementation of Reader and Writer will
not perform any bounds checks on the slice. It is up to the caller to
ensure that any Reader or Writer operations performed are within
the bounds of the slice.
§Reading
- The total number of bytes accessed/consumed must be within the bounds of the slice.
§Writing
- All writes performed must stay within the bounds of the slice.
- It is permitted to overwrite the same bytes multiple times.
Trait Implementations§
Source§impl<'a> Reader<'a> for SliceMutUnchecked<'a, u8>
impl<'a> Reader<'a> for SliceMutUnchecked<'a, u8>
Source§const BORROW_KINDS: u8
const BORROW_KINDS: u8
Borrow capabilities of this reader. Read more
Source§fn copy_into_slice(&mut self, dst: &mut [u8]) -> ReadResult<()>
fn copy_into_slice(&mut self, dst: &mut [u8]) -> ReadResult<()>
Attempts to copy and consume exactly
dst.len() bytes. Read moreSource§fn copy_into_uninit_slice(
&mut self,
dst: &mut [MaybeUninit<u8>],
) -> ReadResult<()>
fn copy_into_uninit_slice( &mut self, dst: &mut [MaybeUninit<u8>], ) -> ReadResult<()>
Attempts to copy and consume exactly
dst.len() bytes into potentially
uninitialized storage. Read moreSource§fn take_array<const N: usize>(&mut self) -> ReadResult<[u8; N]>
fn take_array<const N: usize>(&mut self) -> ReadResult<[u8; N]>
Source§fn take_borrowed_mut(&mut self, len: usize) -> ReadResult<&'a mut [u8]>
fn take_borrowed_mut(&mut self, len: usize) -> ReadResult<&'a mut [u8]>
Source§fn take_borrowed(&mut self, len: usize) -> ReadResult<&'a [u8]>
fn take_borrowed(&mut self, len: usize) -> ReadResult<&'a [u8]>
Source§fn take_scoped(&mut self, len: usize) -> ReadResult<&[u8]>
fn take_scoped(&mut self, len: usize) -> ReadResult<&[u8]>
Source§fn supports_borrow(&self, kind: BorrowKind) -> bool
fn supports_borrow(&self, kind: BorrowKind) -> bool
Checks if this reader supports the given borrow kind. Read more
Source§unsafe fn as_trusted_for(
&mut self,
n_bytes: usize,
) -> ReadResult<impl Reader<'a>>
unsafe fn as_trusted_for( &mut self, n_bytes: usize, ) -> ReadResult<impl Reader<'a>>
Source§unsafe fn as_trusted_for_seq(
&mut self,
len: usize,
size: usize,
) -> Result<impl Reader<'a>, ReadError>
unsafe fn as_trusted_for_seq( &mut self, len: usize, size: usize, ) -> Result<impl Reader<'a>, ReadError>
Source§unsafe fn copy_into_t<T>(&mut self, dst: &mut MaybeUninit<T>) -> ReadResult<()>
unsafe fn copy_into_t<T>(&mut self, dst: &mut MaybeUninit<T>) -> ReadResult<()>
Source§unsafe fn copy_into_slice_t<T>(
&mut self,
dst: &mut [MaybeUninit<T>],
) -> ReadResult<()>
unsafe fn copy_into_slice_t<T>( &mut self, dst: &mut [MaybeUninit<T>], ) -> ReadResult<()>
Source§impl Writer for SliceMutUnchecked<'_, u8>
impl Writer for SliceMutUnchecked<'_, u8>
Source§fn write(&mut self, src: &[u8]) -> WriteResult<()>
fn write(&mut self, src: &[u8]) -> WriteResult<()>
Write exactly
src.len() bytes from the given src into the writer.Source§fn finish(&mut self) -> WriteResult<()>
fn finish(&mut self) -> WriteResult<()>
Finalize the writer by performing any required cleanup or flushing. Read more
Source§unsafe fn as_trusted_for(&mut self, n_bytes: usize) -> WriteResult<impl Writer>
unsafe fn as_trusted_for(&mut self, n_bytes: usize) -> WriteResult<impl Writer>
Source§unsafe fn write_t<T: ?Sized>(&mut self, src: &T) -> WriteResult<()>
unsafe fn write_t<T: ?Sized>(&mut self, src: &T) -> WriteResult<()>
Write
T as bytes into the source. Read moreSource§unsafe fn write_slice_t<T>(&mut self, src: &[T]) -> WriteResult<()>
unsafe fn write_slice_t<T>(&mut self, src: &[T]) -> WriteResult<()>
Write
[T] as bytes into the source. Read moreSource§impl Writer for SliceMutUnchecked<'_, MaybeUninit<u8>>
impl Writer for SliceMutUnchecked<'_, MaybeUninit<u8>>
Source§fn write(&mut self, src: &[u8]) -> WriteResult<()>
fn write(&mut self, src: &[u8]) -> WriteResult<()>
Write exactly
src.len() bytes from the given src into the writer.Source§fn finish(&mut self) -> WriteResult<()>
fn finish(&mut self) -> WriteResult<()>
Finalize the writer by performing any required cleanup or flushing. Read more
Source§unsafe fn as_trusted_for(&mut self, n_bytes: usize) -> WriteResult<impl Writer>
unsafe fn as_trusted_for(&mut self, n_bytes: usize) -> WriteResult<impl Writer>
Source§unsafe fn write_t<T: ?Sized>(&mut self, src: &T) -> WriteResult<()>
unsafe fn write_t<T: ?Sized>(&mut self, src: &T) -> WriteResult<()>
Write
T as bytes into the source. Read moreSource§unsafe fn write_slice_t<T>(&mut self, src: &[T]) -> WriteResult<()>
unsafe fn write_slice_t<T>(&mut self, src: &[T]) -> WriteResult<()>
Write
[T] as bytes into the source. Read moreAuto Trait Implementations§
impl<'a, T> !UnwindSafe for SliceMutUnchecked<'a, T>
impl<'a, T> Freeze for SliceMutUnchecked<'a, T>
impl<'a, T> RefUnwindSafe for SliceMutUnchecked<'a, T>where
&'a mut [T]: RefUnwindSafe,
impl<'a, T> Send for SliceMutUnchecked<'a, T>
impl<'a, T> Sync for SliceMutUnchecked<'a, T>
impl<'a, T> Unpin for SliceMutUnchecked<'a, T>
impl<'a, T> UnsafeUnpin for SliceMutUnchecked<'a, T>where
&'a mut [T]: UnsafeUnpin,
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