pub trait Reader {
// Required methods
fn capacity(&self) -> usize;
fn skip(&mut self, len: usize) -> Result<(), WriteTooLargeError>;
fn write_to<W: Writer>(
&mut self,
writer: &mut W,
n: usize,
) -> Result<(), WriteTooLargeError>;
// Provided methods
fn write_to_buf(
&mut self,
buf: BufMut<'_>,
) -> Result<(), WriteTooLargeError> { ... }
fn write_to_slice(
&mut self,
buf: &mut [u8],
) -> Result<(), WriteTooLargeError> { ... }
}Expand description
An object from which bytes can be read.
Required Methods§
Sourcefn capacity(&self) -> usize
fn capacity(&self) -> usize
Return the number of bytes that can still be read from self.
When the reader can generate arbitrary long output streams, usize::MAX
is returned.
Provided Methods§
Sourcefn write_to_buf(&mut self, buf: BufMut<'_>) -> Result<(), WriteTooLargeError>
fn write_to_buf(&mut self, buf: BufMut<'_>) -> Result<(), WriteTooLargeError>
Sourcefn write_to_slice(&mut self, buf: &mut [u8]) -> Result<(), WriteTooLargeError>
fn write_to_slice(&mut self, buf: &mut [u8]) -> Result<(), WriteTooLargeError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.