pub trait Reader: Storage {
// Required methods
fn current_offset(&self) -> VarInt;
fn final_offset(&self) -> Option<VarInt>;
// Provided methods
fn has_buffered_fin(&self) -> bool { ... }
fn is_consumed(&self) -> bool { ... }
fn skip_until(&mut self, offset: VarInt) -> Result<(), Self::Error> { ... }
fn with_max_data(&mut self, max_data: VarInt) -> Limit<'_, Self> { ... }
fn with_read_limit(&mut self, max_buffered_len: usize) -> Limit<'_, Self> { ... }
fn with_empty_buffer(&self) -> Empty<'_, Self> { ... }
fn with_checks(&mut self) -> Checked<'_, Self> { ... }
}
Expand description
A buffer that can be read with a tracked offset and final position.
Required Methods§
Sourcefn current_offset(&self) -> VarInt
fn current_offset(&self) -> VarInt
Returns the currently read offset for the stream
Sourcefn final_offset(&self) -> Option<VarInt>
fn final_offset(&self) -> Option<VarInt>
Returns the final offset for the stream
Provided Methods§
Sourcefn has_buffered_fin(&self) -> bool
fn has_buffered_fin(&self) -> bool
Returns true
if the reader has the final offset buffered
Sourcefn is_consumed(&self) -> bool
fn is_consumed(&self) -> bool
Returns true
if the reader is finished producing data
Sourcefn skip_until(&mut self, offset: VarInt) -> Result<(), Self::Error>
fn skip_until(&mut self, offset: VarInt) -> Result<(), Self::Error>
Skips the data in the reader until offset
is reached, or the reader storage is exhausted.
Sourcefn with_max_data(&mut self, max_data: VarInt) -> Limit<'_, Self>
fn with_max_data(&mut self, max_data: VarInt) -> Limit<'_, Self>
Limits the maximum offset that the caller can read from the reader
Sourcefn with_read_limit(&mut self, max_buffered_len: usize) -> Limit<'_, Self>
fn with_read_limit(&mut self, max_buffered_len: usize) -> Limit<'_, Self>
Limits the maximum amount of data that the caller can read from the reader
Sourcefn with_empty_buffer(&self) -> Empty<'_, Self>
fn with_empty_buffer(&self) -> Empty<'_, Self>
Return an empty view onto the reader, with no change in current offset
Sourcefn with_checks(&mut self) -> Checked<'_, Self>
fn with_checks(&mut self) -> Checked<'_, Self>
Enables checking the reader for correctness invariants
§Note
debug_assertions
must be enabled for these checks to be performed. Otherwise, the reader
methods will simply be forwarded to Self
.
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.
Implementors§
impl Reader for Reassembler
impl<C> Reader for Complete<'_, C>where
C: Storage,
impl<C, D> Reader for Interposer<'_, C, D>
Delegates to the inner Duplex