Struct IoSliceMut
#[repr(transparent)]
pub struct IoSliceMut<'a>(pub(in ::io::io_slice) IoSliceMut<'a>);
A buffer type used with Read::read_vectored.
It is semantically a wrapper around a &mut [u8], but is guaranteed to be
ABI compatible with the iovec type on Unix platforms and WSABUF on
Windows.
Fields
0: IoSliceMut<'a>
Implementations
impl<'a> IoSliceMut<'a>
fn new(buf: &'a mut [u8]) -> IoSliceMut<'a>Creates a new
IoSliceMutwrapping a byte slice.Panics
Panics on Windows if the slice is larger than 4GB.
fn advance(&mut self, n: usize)Advance the internal cursor of the slice.
Also see
IoSliceMut::advance_slicesto advance the cursors of multiple buffers.Panics
Panics when trying to advance beyond the end of the slice.
Examples
use IoSliceMut; use Deref; let mut data = ; let mut buf = new; // Mark 3 bytes as read. buf.advance; assert_eq!;fn advance_slices(bufs: &mut &mut [IoSliceMut<'a>], n: usize)Advance a slice of slices.
Shrinks the slice to remove any
IoSliceMuts that are fully advanced over. If the cursor ends up in the middle of anIoSliceMut, it is modified to start at that cursor.For example, if we have a slice of two 8-byte
IoSliceMuts, and we advance by 10 bytes, the result will only include the secondIoSliceMut, advanced by 2 bytes.Panics
Panics when trying to advance beyond the end of the slices.
Examples
use IoSliceMut; use Deref; let mut buf1 = ; let mut buf2 = ; let mut buf3 = ; let mut bufs = &mut ; // Mark 10 bytes as read. advance_slices; assert_eq!; assert_eq!;const fn into_slice(self) -> &'a mut [u8]Get the underlying bytes as a mutable slice with the original lifetime.
Examples
use IoSliceMut; let mut data = *b"abcdef"; let io_slice = new; io_slice.into_slice = b'A'; assert_eq!;
Trait Implementations
impl<'a> Debug for IoSliceMut<'a>
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result
impl<'a> Deref for IoSliceMut<'a>
type Target = [u8];fn deref(&self) -> &[u8]
impl<'a> DerefMut for IoSliceMut<'a>
fn deref_mut(&mut self) -> &mut [u8]
impl<'a> Send for IoSliceMut<'a>
impl<'a> Sync for IoSliceMut<'a>
Auto Trait Implementations
impl<'a> !UnwindSafe for IoSliceMut<'a>
impl<'a> Freeze for IoSliceMut<'a>
impl<'a> RefUnwindSafe for IoSliceMut<'a>
impl<'a> Unpin for IoSliceMut<'a>
impl<'a> UnsafeUnpin for IoSliceMut<'a>
Blanket Implementations
impl<P, T> Receiver for IoSliceMut<'a>
where
P: Deref<Target = T> + ?Sized,
T: ?Sized,
type Target = T;
impl<T> Any for IoSliceMut<'a>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for IoSliceMut<'a>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for IoSliceMut<'a>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for IoSliceMut<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for IoSliceMut<'a>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for IoSliceMut<'a>
impl<T, U> Into<U> for IoSliceMut<'a>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for IoSliceMut<'a>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for IoSliceMut<'a>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>