pub struct BufReader<R> { /* private fields */ }
Expand description
The BufReader<R>
struct adds buffering to any reader.
Implementations§
source§impl<R> BufReader<R>
impl<R> BufReader<R>
sourcepub 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.
sourcepub const fn capacity(&self) -> usize
pub const fn capacity(&self) -> usize
Returns the number of bytes the internal buffer can hold at once.
sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Unwraps this BufReader<R>
, returning the underlying reader.
Trait Implementations§
source§impl<R> BufRead for BufReader<R>where
R: Read,
impl<R> BufRead for BufReader<R>where
R: Read,
source§fn fill_buf(&mut self) -> Result<&[u8], AxError>
fn fill_buf(&mut self) -> Result<&[u8], AxError>
Returns the contents of the internal buffer, filling it with more data
from the inner reader if it is empty.
source§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
.source§fn has_data_left(&mut self) -> Result<bool, AxError>
fn has_data_left(&mut self) -> Result<bool, AxError>
Check if the underlying
Read
has any data left to be read.source§impl<R> Read for BufReader<R>where
R: Read,
impl<R> Read for BufReader<R>where
R: Read,
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, AxError>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, AxError>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read.
source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), AxError>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), AxError>
Read the exact number of bytes required to fill
buf
.source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError>
Available on crate feature
alloc
only.Read all bytes until EOF in this source, placing them into
buf
.Auto Trait Implementations§
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