pub struct Uninit<T>(/* private fields */);Expand description
A Slice that only exposes uninitialized bytes.
Uninit can be created with IoBufMut::uninit.
Implementations§
Source§impl<T> Uninit<T>
impl<T> Uninit<T>
Sourcepub fn begin(&self) -> usize
pub fn begin(&self) -> usize
Offset in the underlying buffer at which uninitialized bytes starts.
Sourcepub 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.
Sourcepub 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§
Source§impl<T: IoBuf> IoBuf for Uninit<T>
impl<T: IoBuf> IoBuf for Uninit<T>
Source§impl<T: IoBufMut> IoBufMut for Uninit<T>
impl<T: IoBufMut> IoBufMut for Uninit<T>
Source§fn as_uninit(&mut self) -> &mut [MaybeUninit<u8>]
fn as_uninit(&mut self) -> &mut [MaybeUninit<u8>]
Get the full mutable slice of the buffer, including both initialized
and uninitialized bytes.
Source§fn reserve(&mut self, len: usize) -> Result<(), ReserveError>
fn reserve(&mut self, len: usize) -> Result<(), ReserveError>
Reserve additional capacity for the buffer. Read more
Source§fn reserve_exact(&mut self, len: usize) -> Result<(), ReserveExactError>
fn reserve_exact(&mut self, len: usize) -> Result<(), ReserveExactError>
Reserve exactly
len additional capacity for the buffer. Read moreSource§fn buf_capacity(&mut self) -> usize
fn buf_capacity(&mut self) -> usize
Total capacity of the buffer, including both initialized and
uninitialized bytes.
Source§fn buf_mut_ptr(&mut self) -> *mut MaybeUninit<u8>
fn buf_mut_ptr(&mut self) -> *mut MaybeUninit<u8>
Get the raw mutable pointer to the buffer.
Source§fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Get the mutable slice of initialized bytes. The content is the same as
IoBuf::as_init, but mutable.Source§fn extend_from_slice(&mut self, src: &[u8]) -> Result<(), ReserveError>
fn extend_from_slice(&mut self, src: &[u8]) -> Result<(), ReserveError>
Extend the buffer by copying bytes from
src. Read moreSource§fn copy_within<R>(&mut self, src: R, dest: usize)where
R: RangeBounds<usize>,
fn copy_within<R>(&mut self, src: R, dest: usize)where
R: RangeBounds<usize>,
Like
slice::copy_within, copy a range of bytes within the buffer to
another location in the same buffer. This will count in both initialized
and uninitialized bytes. Read moreSource§fn into_writer(self) -> Writer<Self> ⓘwhere
Self: Sized,
fn into_writer(self) -> Writer<Self> ⓘwhere
Self: Sized,
Create a
Writer from this buffer, which implements
std::io::Write.Source§impl<T: Ord> Ord for Uninit<T>
impl<T: Ord> Ord for Uninit<T>
Source§impl<T: PartialOrd> PartialOrd for Uninit<T>
impl<T: PartialOrd> PartialOrd for Uninit<T>
Source§impl<T: SetLen + IoBuf> SetLen for Uninit<T>
impl<T: SetLen + IoBuf> SetLen for Uninit<T>
impl<T: Copy> Copy for Uninit<T>
impl<T: Eq> Eq for Uninit<T>
impl<T> StructuralPartialEq for Uninit<T>
Auto Trait Implementations§
impl<T> Freeze for Uninit<T>where
T: Freeze,
impl<T> RefUnwindSafe for Uninit<T>where
T: RefUnwindSafe,
impl<T> Send for Uninit<T>where
T: Send,
impl<T> Sync for Uninit<T>where
T: Sync,
impl<T> Unpin for Uninit<T>where
T: Unpin,
impl<T> UnwindSafe for Uninit<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