pub struct Slice<T> { /* private fields */ }
Expand description
An owned view into a contiguous sequence of bytes. Slice implements IoBuf.
Implementations§
Source§impl<T> Slice<T>
impl<T> Slice<T>
Sourcepub const unsafe fn new_unchecked(buf: T, begin: usize, end: usize) -> Self
pub const unsafe fn new_unchecked(buf: T, begin: usize, end: usize) -> Self
Create a Slice from a buffer and range without boundary checking.
§Safety
begin and end must be within the buffer initialized range.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Unwraps this Slice
, returning the underlying buffer.
Trait Implementations§
Source§impl<T: IoBuf> IoBuf for Slice<T>
impl<T: IoBuf> IoBuf for Slice<T>
Source§fn bytes_init(&self) -> usize
fn bytes_init(&self) -> usize
Number of initialized bytes. Read more
Source§fn slice(self, range: impl RangeBounds<usize>) -> Slice<Self>where
Self: Sized,
fn slice(self, range: impl RangeBounds<usize>) -> Slice<Self>where
Self: Sized,
Returns a view of the buffer with the specified range.
Source§unsafe fn slice_unchecked(self, range: impl RangeBounds<usize>) -> Slice<Self>where
Self: Sized,
unsafe fn slice_unchecked(self, range: impl RangeBounds<usize>) -> Slice<Self>where
Self: Sized,
Returns a view of the buffer with the specified range without boundary
checking. Read more
Auto Trait Implementations§
impl<T> Freeze for Slice<T>where
T: Freeze,
impl<T> RefUnwindSafe for Slice<T>where
T: RefUnwindSafe,
impl<T> Send for Slice<T>where
T: Send,
impl<T> Sync for Slice<T>where
T: Sync,
impl<T> Unpin for Slice<T>where
T: Unpin,
impl<T> UnwindSafe for Slice<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