Struct buffered_reader::Dup
source · pub struct Dup<T: BufferedReader<C>, C: Debug + Sync + Send> { /* private fields */ }Expand description
Duplicates the underlying BufferedReader without consuming any
of the data.
Note: this will likely cause the underlying stream to buffer as
much data as you read. Thus, it should only be used for peeking
at the underlying BufferedReader.
Implementations§
Trait Implementations§
source§impl<T: BufferedReader<C>, C: Debug + Send + Sync> BufferedReader<C> for Dup<T, C>
impl<T: BufferedReader<C>, C: Debug + Send + Sync> BufferedReader<C> for Dup<T, C>
source§fn data(&mut self, amount: usize) -> Result<&[u8], Error>
fn data(&mut self, amount: usize) -> Result<&[u8], Error>
Ensures that the internal buffer has at least
amount bytes
of data, and returns it. Read moresource§fn get_mut(&mut self) -> Option<&mut dyn BufferedReader<C>>
fn get_mut(&mut self) -> Option<&mut dyn BufferedReader<C>>
Returns a mutable reference to the inner
BufferedReader, if
any. Read moresource§fn get_ref(&self) -> Option<&dyn BufferedReader<C>>
fn get_ref(&self) -> Option<&dyn BufferedReader<C>>
Returns a reference to the inner
BufferedReader, if any.source§fn into_inner<'b>(self: Box<Self>) -> Option<Box<dyn BufferedReader<C> + 'b>>where
Self: 'b,
fn into_inner<'b>(self: Box<Self>) -> Option<Box<dyn BufferedReader<C> + 'b>>where Self: 'b,
Returns the underlying reader, if any. Read more
Sets the
BufferedReader’s cookie and returns the old value.Returns a reference to the
BufferedReader’s cookie.Returns a mutable reference to the
BufferedReader’s cookie.source§fn data_eof(&mut self) -> Result<&[u8], Error>
fn data_eof(&mut self) -> Result<&[u8], Error>
Returns all of the data until EOF. Like
data(), this does not
actually consume the data that is read. Read moresource§fn consummated(&mut self) -> bool
fn consummated(&mut self) -> bool
Checks whether this reader is consummated. Read more
source§fn read_be_u16(&mut self) -> Result<u16, Error>
fn read_be_u16(&mut self) -> Result<u16, Error>
A convenience function for reading a 16-bit unsigned integer
in big endian format.
source§fn read_be_u32(&mut self) -> Result<u32, Error>
fn read_be_u32(&mut self) -> Result<u32, Error>
A convenience function for reading a 32-bit unsigned integer
in big endian format.
source§fn read_to(&mut self, terminal: u8) -> Result<&[u8], Error>
fn read_to(&mut self, terminal: u8) -> Result<&[u8], Error>
Reads until either
terminal is encountered or EOF. Read moresource§fn drop_until(&mut self, terminals: &[u8]) -> Result<usize, Error>
fn drop_until(&mut self, terminals: &[u8]) -> Result<usize, Error>
Discards the input until one of the bytes in terminals is
encountered. Read more
source§fn drop_through(
&mut self,
terminals: &[u8],
match_eof: bool
) -> Result<(Option<u8>, usize), Error>
fn drop_through( &mut self, terminals: &[u8], match_eof: bool ) -> Result<(Option<u8>, usize), Error>
Discards the input until one of the bytes in
terminals is
encountered. Read moresource§fn steal(&mut self, amount: usize) -> Result<Vec<u8>, Error>
fn steal(&mut self, amount: usize) -> Result<Vec<u8>, Error>
Like
data_consume_hard(), but returns the data in a
caller-owned buffer. Read moresource§fn steal_eof(&mut self) -> Result<Vec<u8>, Error>
fn steal_eof(&mut self) -> Result<Vec<u8>, Error>
Like
steal(), but instead of stealing a fixed number of
bytes, steals all of the data until the end of file.source§fn drop_eof(&mut self) -> Result<bool, Error>
fn drop_eof(&mut self) -> Result<bool, Error>
Like
steal_eof(), but instead of returning the data, the
data is discarded. Read moresource§impl<T: BufferedReader<C>, C: Debug + Sync + Send> Read for Dup<T, C>
impl<T: BufferedReader<C>, C: Debug + Sync + Send> Read for Dup<T, C>
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
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, Global>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
Read 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>
Read 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>
Read the exact number of bytes required to fill
buf. Read moresource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> 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<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf)Read 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” adaptor for this instance of
Read. Read moreAuto Trait Implementations§
impl<T, C> RefUnwindSafe for Dup<T, C>where C: RefUnwindSafe, T: RefUnwindSafe,
impl<T, C> Send for Dup<T, C>
impl<T, C> Sync for Dup<T, C>
impl<T, C> Unpin for Dup<T, C>where C: Unpin, T: Unpin,
impl<T, C> UnwindSafe for Dup<T, C>where C: UnwindSafe, T: 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