packet::serialize

Function new_buf_vec

Source
pub fn new_buf_vec(len: usize) -> Result<Buf<Vec<u8>>, Infallible>
Expand description

Allocates a new Buf<Vec<u8>>.

new_buf_vec(len) is shorthand for Ok(Buf::new(vec![0; len], ..)). It implements BufferAlloc<Buf<Vec<u8>>, Error = Never>, and, thanks to a blanket impl, BufferProvider<I, Either<I, Buf<Vec<u8>>>, Error = Never> for all I: BufferMut, and BufferProvider<Buf<Vec<u8>>, Buf<Vec<u8>>, Error = Never>.