kvarn_async::prelude::bytes::buf

Struct Writer

pub struct Writer<B> { /* private fields */ }
Expand description

A BufMut adapter which implements io::Write for the inner value.

This struct is generally created by calling writer() on BufMut. See documentation of writer() for more details.

Implementations§

§

impl<B> Writer<B>
where B: BufMut,

pub fn get_ref(&self) -> &B

Gets a reference to the underlying BufMut.

It is inadvisable to directly write to the underlying BufMut.

§Examples
use bytes::BufMut;

let buf = Vec::with_capacity(1024).writer();

assert_eq!(1024, buf.get_ref().capacity());

pub fn get_mut(&mut self) -> &mut B

Gets a mutable reference to the underlying BufMut.

It is inadvisable to directly write to the underlying BufMut.

§Examples
use bytes::BufMut;

let mut buf = vec![].writer();

buf.get_mut().reserve(1024);

assert_eq!(1024, buf.get_ref().capacity());

pub fn into_