pub trait NestedDecodeInput {
// Required methods
fn remaining_len(&self) -> usize;
fn read_into(&mut self, into: &mut [u8]) -> Result<(), DecodeError>;
fn read_into_or_exit<ExitCtx: Clone>(
&mut self,
into: &mut [u8],
c: ExitCtx,
exit: fn(ExitCtx, DecodeError) -> !,
);
// Provided methods
fn is_depleted(&self) -> bool { ... }
fn read_specialized<T, C, F>(
&mut self,
_context: C,
else_deser: F,
) -> Result<T, DecodeError>
where T: TryStaticCast,
C: TryStaticCast,
F: FnOnce(&mut Self) -> Result<T, DecodeError> { ... }
fn read_specialized_or_exit<T, C, ExitCtx, F>(
&mut self,
_context: C,
c: ExitCtx,
_exit: fn(ExitCtx, DecodeError) -> !,
else_deser: F,
) -> T
where T: TryStaticCast,
C: TryStaticCast,
F: FnOnce(&mut Self, ExitCtx) -> T,
ExitCtx: Clone { ... }
fn read_byte(&mut self) -> Result<u8, DecodeError> { ... }
fn read_byte_or_exit<ExitCtx: Clone>(
&mut self,
c: ExitCtx,
exit: fn(ExitCtx, DecodeError) -> !,
) -> u8 { ... }
}Expand description
Trait that allows deserializing objects from a buffer.
Required Methods§
Sourcefn remaining_len(&self) -> usize
fn remaining_len(&self) -> usize
The remaining length of the input data.
Sourcefn read_into(&mut self, into: &mut [u8]) -> Result<(), DecodeError>
fn read_into(&mut self, into: &mut [u8]) -> Result<(), DecodeError>
Read the exact number of bytes required to fill the given buffer.
Sourcefn read_into_or_exit<ExitCtx: Clone>(
&mut self,
into: &mut [u8],
c: ExitCtx,
exit: fn(ExitCtx, DecodeError) -> !,
)
fn read_into_or_exit<ExitCtx: Clone>( &mut self, into: &mut [u8], c: ExitCtx, exit: fn(ExitCtx, DecodeError) -> !, )
Read the exact number of bytes required to fill the given buffer. Exit early if there are not enough bytes to fill the result.
Provided Methods§
Sourcefn is_depleted(&self) -> bool
fn is_depleted(&self) -> bool
True if all data from the buffer has already been used.
fn read_specialized<T, C, F>( &mut self, _context: C, else_deser: F, ) -> Result<T, DecodeError>
fn read_specialized_or_exit<T, C, ExitCtx, F>( &mut self, _context: C, c: ExitCtx, _exit: fn(ExitCtx, DecodeError) -> !, else_deser: F, ) -> T
Sourcefn read_byte(&mut self) -> Result<u8, DecodeError>
fn read_byte(&mut self) -> Result<u8, DecodeError>
Read a single byte from the input.
Sourcefn read_byte_or_exit<ExitCtx: Clone>(
&mut self,
c: ExitCtx,
exit: fn(ExitCtx, DecodeError) -> !,
) -> u8
fn read_byte_or_exit<ExitCtx: Clone>( &mut self, c: ExitCtx, exit: fn(ExitCtx, DecodeError) -> !, ) -> u8
Read a single byte from the input.
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.
Implementations on Foreign Types§
Source§impl<'a> NestedDecodeInput for &'a [u8]
A nested decode buffer implementation on referenced data.
impl<'a> NestedDecodeInput for &'a [u8]
A nested decode buffer implementation on referenced data.