Struct buffered_reader::EOF
source · [−]pub struct EOF<C> { /* private fields */ }
Expand description
Always returns EOF.
Implementations
Trait Implementations
sourceimpl<C: Debug + Sync + Send> BufferedReader<C> for EOF<C>
impl<C: Debug + Sync + Send> BufferedReader<C> for EOF<C>
sourcefn buffer(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn buffer(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Returns a reference to the internal buffer. Read more
sourcefn 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 more
sourcefn consume(&mut self, amount: usize) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn consume(&mut self, amount: usize) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Consumes some of the data. Read more
sourcefn data_consume(&mut self, _amount: usize) -> Result<&[u8], Error>
fn data_consume(&mut self, _amount: usize) -> Result<&[u8], Error>
A convenience function that combines data()
and consume()
. Read more
sourcefn data_consume_hard(&mut self, amount: usize) -> Result<&[u8], Error>
fn data_consume_hard(&mut self, amount: usize) -> Result<&[u8], Error>
A convenience function that effectively combines data_hard()
and consume()
. Read more
sourcefn into_inner<'a>(self: Box<Self>) -> Option<Box<dyn BufferedReader<C> + 'a>> where
Self: 'a,
fn into_inner<'a>(self: Box<Self>) -> Option<Box<dyn BufferedReader<C> + 'a>> where
Self: 'a,
Returns the underlying reader, if any. Read more
sourcefn 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 more
sourcefn get_ref(&self) -> Option<&dyn BufferedReader<C>>
fn get_ref(&self) -> Option<&dyn BufferedReader<C>>
Returns a reference to the inner BufferedReader
, if any.
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.
sourcefn data_hard(&mut self, amount: usize) -> Result<&[u8], Error>
fn data_hard(&mut self, amount: usize) -> Result<&[u8], Error>
Like data()
, but returns an error if there is not at least
amount
bytes available. Read more
sourcefn 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 more
sourcefn consummated(&mut self) -> bool
fn consummated(&mut self) -> bool
Checks whether this reader is consummated. Read more
sourcefn 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. Read more
sourcefn 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. Read more
sourcefn 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 more
sourcefn 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
sourcefn 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 more
sourcefn 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 more
sourcefn 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. Read more
sourcefn 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 more
sourcefn dump(&self, sink: &mut dyn Write) -> Result<()> where
Self: Sized,
fn dump(&self, sink: &mut dyn Write) -> Result<()> where
Self: Sized,
A helpful debugging aid to pretty print a Buffered Reader stack. Read more
sourcefn as_boxed<'a>(self) -> Box<dyn BufferedReader<C> + 'a> where
Self: 'a + Sized,
fn as_boxed<'a>(self) -> Box<dyn BufferedReader<C> + 'a> where
Self: 'a + Sized,
Boxes the reader.
sourceimpl<C> Read for EOF<C>
impl<C> Read for EOF<C>
sourcefn 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 · sourcefn 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 more
sourcefn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)Determines if this Read
er has an efficient read_vectored
implementation. Read more
1.0.0 · sourcefn 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 more
1.0.0 · sourcefn 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 more
1.6.0 · sourcefn 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 more
sourcefn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf
)Pull some bytes from this source into the specified buffer. Read more
sourcefn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf
)Read the exact number of bytes required to fill buf
. Read more
1.0.0 · sourcefn by_ref(&mut self) -> &mut Self
fn by_ref(&mut self) -> &mut Self
Creates a “by reference” adaptor for this instance of Read
. Read more
Auto Trait Implementations
impl<C> RefUnwindSafe for EOF<C> where
C: RefUnwindSafe,
impl<C> Send for EOF<C> where
C: Send,
impl<C> Sync for EOF<C> where
C: Sync,
impl<C> Unpin for EOF<C> where
C: Unpin,
impl<C> UnwindSafe for EOF<C> where
C: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more