Trait SetLen
pub trait SetLen {
// Required method
unsafe fn set_len(&mut self, len: usize);
// Provided methods
unsafe fn advance_to(&mut self, len: usize)
where Self: IoBuf { ... }
unsafe fn advance_vec_to(&mut self, len: usize)
where Self: IoVectoredBuf { ... }
fn clear(&mut self)
where Self: IoBuf { ... }
}Expand description
A helper trait for set_len like methods.
Required Methods§
Provided Methods§
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.
§Safety
lenmust be less or equal thanas_uninit().len().- The bytes in the range
[buf_len(), len)must be initialized.
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.
§Safety
lenmust be less or equal thantotal_len().- The bytes in the range
[total_len(), len)must be initialized.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
§impl SetLen for BorrowedBuf<'static>
Available on crate feature read_buf only.
impl SetLen for BorrowedBuf<'static>
Available on crate feature
read_buf only.§impl<B> SetLen for &'static mut B
impl<B> SetLen for &'static mut B
§impl<T, Rest> SetLen for (T, Rest)where
T: IoBufMut,
Rest: IoVectoredBufMut,
impl<T, Rest> SetLen for (T, Rest)where
T: IoBufMut,
Rest: IoVectoredBufMut,
Implementors§
impl SetLen for BytesMut
Available on crate feature
bytes only.impl<A> SetLen for Vec<u8, A>where
A: Allocator + 'static,
impl<B, A> SetLen for Box<B, A>
impl<T> SetLen for Slice<T>where
T: SetLen,
impl<T> SetLen for Uninit<T>
impl<T> SetLen for VectoredBufIter<T>where
T: IoVectoredBuf + SetLen,
impl<T> SetLen for VectoredSlice<T>where
T: SetLen,
impl<T, A> SetLen for Vec<T, A>
impl<T, const N: usize> SetLen for ArrayVec<T, N>where
T: IoBufMut,
Available on crate feature
arrayvec only.impl<const N: usize> SetLen for ArrayVec<u8, N>
Available on crate feature
arrayvec only.