Struct VectoredSlice
pub struct VectoredSlice<T> { /* private fields */ }Expand description
Return type for IoVectoredBuf::slice and
IoVectoredBufMut::slice_mut.
§Behavior
When constructing the VectoredSlice, it will first compute how
many buffers to skip. Imaging vectored buffers as concatenated slices, there
will be uninitialized “slots” in between. This slice type provides two
behaviors of how to skip through those slots, controlled by the marker type
B:
IoVectoredBuf::slice: Ignore uninitialized slots, i.e., skipbegin-many initialized bytes.IoVectoredBufMut::slice_mut: Consider uninitialized slots, i.e., skipbegin-many bytes.
This will only affect how the slice is being constructed. The resulting
slice will always expose all of the remaining bytes, no matter initialized
or not (in particular, IoVectoredBufMut::iter_uninit_slice).
Implementations§
§impl<T> VectoredSlice<T>
impl<T> VectoredSlice<T>
pub fn as_inner(&self) -> &T
pub fn as_inner(&self) -> &T
Gets a reference to the underlying buffer.
This method escapes the slice’s view.
pub fn as_inner_mut(&mut self) -> &mut T
pub fn as_inner_mut(&mut self) -> &mut T
Gets a mutable reference to the underlying buffer.
This method escapes the slice’s view.
Trait Implementations§
§impl<T> IntoInner for VectoredSlice<T>
impl<T> IntoInner for VectoredSlice<T>
§fn into_inner(self) -> <VectoredSlice<T> as IntoInner>::Inner
fn into_inner(self) -> <VectoredSlice<T> as IntoInner>::Inner
Get the inner buffer.
§impl<T> IoVectoredBuf for VectoredSlice<T>where
T: IoVectoredBuf,
impl<T> IoVectoredBuf for VectoredSlice<T>where
T: IoVectoredBuf,
§fn iter_slice(&self) -> impl Iterator<Item = &[u8]>
fn iter_slice(&self) -> impl Iterator<Item = &[u8]>
An iterator of initialized slice of the buffers.
§fn owned_iter(self) -> Result<VectoredBufIter<Self>, Self>where
Self: Sized,
fn owned_iter(self) -> Result<VectoredBufIter<Self>, Self>where
Self: Sized,
Wrap self into an owned iterator.
§impl<T> IoVectoredBufMut for VectoredSlice<T>where
T: IoVectoredBufMut,
impl<T> IoVectoredBufMut for VectoredSlice<T>where
T: IoVectoredBufMut,
§fn iter_uninit_slice(&mut self) -> impl Iterator<Item = &mut [MaybeUninit<u8>]>
fn iter_uninit_slice(&mut self) -> impl Iterator<Item = &mut [MaybeUninit<u8>]>
An iterator of maybe uninitialized slice of the buffers.
§fn total_capacity(&mut self) -> usize
fn total_capacity(&mut self) -> usize
The total capacity of all buffers.
§impl<T> SetLen for VectoredSlice<T>where
T: SetLen,
impl<T> SetLen for VectoredSlice<T>where
T: SetLen,
§unsafe fn advance_to(&mut self, len: usize)where
Self: IoBuf,
unsafe fn advance_to(&mut self, len: usize)where
Self: IoBuf,
Set the buffer length to
len. If len is less than the current
length, this operation is a no-op. Read more§unsafe fn advance_vec_to(&mut self, len: usize)where
Self: IoVectoredBuf,
unsafe fn advance_vec_to(&mut self, len: usize)where
Self: IoVectoredBuf,
Set the vector buffer’s total length to
len. If len is less than the
current total length, this operation is a no-op. Read moreAuto Trait Implementations§
impl<T> Freeze for VectoredSlice<T>where
T: Freeze,
impl<T> RefUnwindSafe for VectoredSlice<T>where
T: RefUnwindSafe,
impl<T> Send for VectoredSlice<T>where
T: Send,
impl<T> Sync for VectoredSlice<T>where
T: Sync,
impl<T> Unpin for VectoredSlice<T>where
T: Unpin,
impl<T> UnwindSafe for VectoredSlice<T>where
T: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more