Struct Reader
pub struct Reader<B> { /* private fields */ }Expand description
A Buf adapter which implements io::Read for the inner value.
This struct is generally created by calling reader() on Buf. See
documentation of reader() for more
details.
Implementations§
§impl<B> Reader<B>where
B: Buf,
impl<B> Reader<B>where
B: Buf,
pub fn get_ref(&self) -> &B
pub fn get_ref(&self) -> &B
Gets a reference to the underlying Buf.
It is inadvisable to directly read from the underlying Buf.
§Examples
use bytes::Buf;
let buf = b"hello world".reader();
assert_eq!(b"hello world", buf.get_ref());pub fn get_mut(&mut self) -> &mut B
pub fn get_mut(&mut self) -> &mut B
Gets a mutable reference to the underlying Buf.
It is inadvisable to directly read from the underlying Buf.
pub fn into_inner(self) -> B
pub fn into_inner(self) -> B
Consumes this Reader, returning the underlying value.
§Examples
use bytes::Buf;
use std::io;
let mut buf =