pub struct BufReaderWithOverflow<R> { /* private fields */ }Expand description
A buffered reader that wraps BufRead instance and implements RequiredLenBufRead.
It uses auxiliary overflow buffer when fill_buf returns slice that doesn’t satisfy
the length requirement.
Implementations§
Trait Implementations§
Source§impl<R: BufRead> BufRead for BufReaderWithOverflow<R>
impl<R: BufRead> BufRead for BufReaderWithOverflow<R>
Source§fn consume(&mut self, amt: usize)
fn consume(&mut self, amt: usize)
Marks the given
amount of additional bytes from the internal buffer as having been read.
Subsequent calls to read only return bytes that have not been marked as read. Read moreSource§fn has_data_left(&mut self) -> Result<bool, Error>
fn has_data_left(&mut self) -> Result<bool, Error>
🔬This is a nightly-only experimental API. (
buf_read_has_data_left)Checks if there is any data left to be
read. Read more1.83.0 · Source§fn skip_until(&mut self, byte: u8) -> Result<usize, Error>
fn skip_until(&mut self, byte: u8) -> Result<usize, Error>
Skips all bytes until the delimiter
byte or EOF is reached. Read moreSource§impl<'a, R: FileBufRead<'a>> FileBufRead<'a> for BufReaderWithOverflow<R>
impl<'a, R: FileBufRead<'a>> FileBufRead<'a> for BufReaderWithOverflow<R>
Source§fn set_file(&mut self, file: &'a File, read_limit: FileSize) -> Result<()>
fn set_file(&mut self, file: &'a File, read_limit: FileSize) -> Result<()>
Activate the given
file as source of reads of this reader. Read moreSource§fn add_file_to_prefetch(
&mut self,
file: &'a File,
read_limit: FileSize,
) -> Result<()>
fn add_file_to_prefetch( &mut self, file: &'a File, read_limit: FileSize, ) -> Result<()>
Queue
file for read-ahead (prefetch). Files are processed in FIFO order
by subsequent set_file calls. Read moreSource§fn get_file_offset(&self) -> FileSize
fn get_file_offset(&self) -> FileSize
Returns the current file offset corresponding to the start of the buffer
that will be returned by the next call to
fill_buf. Read moreSource§fn consume_or_skip(&mut self, amt: usize)
fn consume_or_skip(&mut self, amt: usize)
Advance the offset by
amt bytes, potentially skipping past the current buffer
into the underlying file. Read moreSource§impl<R: BufRead> Read for BufReaderWithOverflow<R>
impl<R: BufRead> Read for BufReaderWithOverflow<R>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read. Read more
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
Like
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
Reads all bytes until EOF in this source, placing them into
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Reads all bytes until EOF in this source, appending them to
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Reads the exact number of bytes required to fill
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_, u8>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_, u8>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf)Pull some bytes from this source into the specified buffer. Read more
Source§fn read_buf_exact(
&mut self,
cursor: BorrowedCursor<'_, u8>,
) -> Result<(), Error>
fn read_buf_exact( &mut self, cursor: BorrowedCursor<'_, u8>, ) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf)Reads the exact number of bytes required to fill
cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Creates a “by reference” adapter for this instance of
Read. Read more1.0.0 · Source§fn chain<R>(self, next: R) -> Chain<Self, R> ⓘ
fn chain<R>(self, next: R) -> Chain<Self, R> ⓘ
Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§fn take(self, limit: u64) -> Take<Self> ⓘwhere
Self: Sized,
fn take(self, limit: u64) -> Take<Self> ⓘwhere
Self: Sized,
Creates an adapter which will read at most
limit bytes from it. Read moreSource§fn read_array<const N: usize>(&mut self) -> Result<[u8; N], Error>where
Self: Sized,
fn read_array<const N: usize>(&mut self) -> Result<[u8; N], Error>where
Self: Sized,
🔬This is a nightly-only experimental API. (
read_array)Read and return a fixed array of bytes from this source. Read more
Source§impl<R: BufRead> RequiredLenBufRead for BufReaderWithOverflow<R>
Support large required_len (within configured limits) by using overflow buffer
retained during lifetime of the reader.
impl<R: BufRead> RequiredLenBufRead for BufReaderWithOverflow<R>
Support large required_len (within configured limits) by using overflow buffer
retained during lifetime of the reader.
Auto Trait Implementations§
impl<R> Freeze for BufReaderWithOverflow<R>where
R: Freeze,
impl<R> RefUnwindSafe for BufReaderWithOverflow<R>where
R: RefUnwindSafe,
impl<R> Send for BufReaderWithOverflow<R>where
R: Send,
impl<R> Sync for BufReaderWithOverflow<R>where
R: Sync,
impl<R> Unpin for BufReaderWithOverflow<R>where
R: Unpin,
impl<R> UnsafeUnpin for BufReaderWithOverflow<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for BufReaderWithOverflow<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