pub struct BufferedReader<R: Read> { /* private fields */ }
Expand description
Similar to std::io::BufRead
, but more performant.
There is no simple way to wrap a standard BufRead
such that it can compute
checksums on consume. This is really something that needs a less restrictive
interface. Apart from enabling checksum computations, this buffered reader
has some convenience functions.
Implementations§
Source§impl<R: Read> BufferedReader<R>
impl<R: Read> BufferedReader<R>
Sourcepub fn new(inner: R) -> BufferedReader<R>
pub fn new(inner: R) -> BufferedReader<R>
Wrap the reader in a new buffered reader.
Sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Destroys the buffered reader, returning the wrapped reader.
Anything in the buffer will be lost.
Trait Implementations§
Source§impl<R: Read> ReadBytes for BufferedReader<R>
impl<R: Read> ReadBytes for BufferedReader<R>
Source§fn read_into(&mut self, buffer: &mut [u8]) -> Result<()>
fn read_into(&mut self, buffer: &mut [u8]) -> Result<()>
Reads until the provided buffer is full.
Source§fn skip(&mut self, amount: u32) -> Result<()>
fn skip(&mut self, amount: u32) -> Result<()>
Skips over the specified number of bytes. Read more
Source§fn read_be_u16(&mut self) -> Result<u16>
fn read_be_u16(&mut self) -> Result<u16>
Reads two bytes and interprets them as a big-endian 16-bit unsigned integer.
Source§fn read_be_u16_or_eof(&mut self) -> Result<Option<u16>>
fn read_be_u16_or_eof(&mut self) -> Result<Option<u16>>
Reads two bytes and interprets them as a big-endian 16-bit unsigned integer.
Source§fn read_be_u24(&mut self) -> Result<u32>
fn read_be_u24(&mut self) -> Result<u32>
Reads three bytes and interprets them as a big-endian 24-bit unsigned integer.
Source§fn read_be_u32(&mut self) -> Result<u32>
fn read_be_u32(&mut self) -> Result<u32>
Reads four bytes and interprets them as a big-endian 32-bit unsigned integer.
Source§fn read_le_u32(&mut self) -> Result<u32>
fn read_le_u32(&mut self) -> Result<u32>
Reads four bytes and interprets them as a little-endian 32-bit unsigned integer.
Auto Trait Implementations§
impl<R> Freeze for BufferedReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for BufferedReader<R>where
R: RefUnwindSafe,
impl<R> Send for BufferedReader<R>where
R: Send,
impl<R> Sync for BufferedReader<R>where
R: Sync,
impl<R> Unpin for BufferedReader<R>where
R: Unpin,
impl<R> UnwindSafe for BufferedReader<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