Struct BufReader
pub struct BufReader<R> { /* private fields */ }Expand description
The BufReader<R> struct adds buffering to any reader.
Implementations§
§impl<R> BufReader<R>
impl<R> BufReader<R>
pub fn buffer(&self) -> &[u8] ⓘ
pub fn buffer(&self) -> &[u8] ⓘ
Returns a reference to the internally buffered data.
Unlike fill_buf, this will not attempt to fill the buffer if it is empty.
pub const fn capacity(&self) -> usize
pub const fn capacity(&self) -> usize
Returns the number of bytes the internal buffer can hold at once.
pub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Unwraps this BufReader<R>, returning the underlying reader.
Trait Implementations§
§impl<R> BufRead for BufReader<R>where
R: Read,
impl<R> BufRead for BufReader<R>where
R: Read,
§fn fill_buf(&mut self) -> Result<&[u8], AxErrorKind>
fn fill_buf(&mut self) -> Result<&[u8], AxErrorKind>
Returns the contents of the internal buffer, filling it with more data
from the inner reader if it is empty.
§fn consume(&mut self, amt: usize)
fn consume(&mut self, amt: usize)
Tells this buffer that
amt bytes have been consumed from the buffer,
so they should no longer be returned in calls to read.§fn has_data_left(&mut self) -> Result<bool, AxErrorKind>
fn has_data_left(&mut self) -> Result<bool, AxErrorKind>
Check if the underlying
Read has any data left to be read.§fn read_until(
&mut self,
byte: u8,
buf: &mut Vec<u8>,
) -> Result<usize, AxErrorKind>
fn read_until( &mut self, byte: u8, buf: &mut Vec<u8>, ) -> Result<usize, AxErrorKind>
Read all bytes into
buf until the delimiter byte or EOF is reached.§impl<R> Read for BufReader<R>where
R: Read,
impl<R> Read for BufReader<R>where
R: Read,
§fn read(&mut self, buf: &mut [u8]) -> Result<usize, AxErrorKind>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, AxErrorKind>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read.
§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), AxErrorKind>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), AxErrorKind>
Read the exact number of bytes required to fill
buf.§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxErrorKind>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxErrorKind>
Read all bytes until EOF in this source, placing them into
buf.§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, AxErrorKind>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, AxErrorKind>
Read all bytes until EOF in this source, appending them to
buf.Auto Trait Implementations§
impl<R> Freeze for BufReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for BufReader<R>where
R: RefUnwindSafe,
impl<R> Send for BufReader<R>where
R: Send,
impl<R> Sync for BufReader<R>where
R: Sync,
impl<R> Unpin for BufReader<R>where
R: Unpin,
impl<R> UnwindSafe for BufReader<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more