Skip to main content

SetLen

Trait SetLen 

pub trait SetLen {
    // Required method
    unsafe fn set_len(&mut self, len: usize);
}
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 first len bytes must actually be initialized and len must be <= 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: SetLen + IoBuf,

§

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