Skip to main content

SetLen

Trait SetLen 

pub trait SetLen {
    // Required method
    unsafe fn set_len(&mut self, len: usize);
}
Available on crate feature std only.
Expand description

Declare how many leading bytes of a buffer are initialized.

Split out of IoBufMut (mirroring compio’s SetLen) so views like Slice and Uninit can forward length-setting without re-implementing the whole mutable-buffer surface.

Required Methods§

unsafe fn set_len(&mut self, len: usize)

Set the initialized length to len.

§Safety

The caller must ensure that the first len bytes of the buffer’s backing storage are initialized and that len is at most the buffer’s total capacity.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl SetLen for BytesMut

§

impl SetLen for Vec<u8>

§

impl<B> SetLen for Uninit<B>
where B: IoBufMut,

§

impl<const N: usize> SetLen for ArrayBuf<N>