pub struct DecoderImpl<R, C: Config, Context> { /* private fields */ }Expand description
A Decoder that reads bytes from a given reader R.
This struct should rarely be used.
In most cases, prefer any of the decode functions.
The ByteOrder that is chosen will impact the endianness that
is used to read integers out of the reader.
use bincode_next::de::{DecoderImpl, Decode};
let mut context = ();
let mut decoder = DecoderImpl::new(some_reader, bincode_next::config::standard(), &mut context);
// this u32 can be any Decode
let value = u32::decode(&mut decoder).unwrap();Implementations§
Trait Implementations§
Source§impl<'de, R: BorrowReader<'de>, C: Config, Context> BorrowDecoder<'de> for DecoderImpl<R, C, Context>
impl<'de, R: BorrowReader<'de>, C: Config, Context> BorrowDecoder<'de> for DecoderImpl<R, C, Context>
Source§impl<R: Reader, C: Config, Context> Decoder for DecoderImpl<R, C, Context>
impl<R: Reader, C: Config, Context> Decoder for DecoderImpl<R, C, Context>
Source§fn claim_bytes_read(&mut self, n: usize) -> Result<(), DecodeError>
fn claim_bytes_read(&mut self, n: usize) -> Result<(), DecodeError>
Claim that
n bytes are going to be read from the decoder.
This can be used to validate Configuration::Limit<N>(). Read moreSource§fn unclaim_bytes_read(&mut self, n: usize)
fn unclaim_bytes_read(&mut self, n: usize)
Notify the decoder that
n bytes are being reclaimed. Read moreSource§fn with_context<C>(&mut self, context: C) -> WithContext<'_, Self, C>
fn with_context<C>(&mut self, context: C) -> WithContext<'_, Self, C>
Wraps decoder with a context
Source§fn claim_container_read<T>(&mut self, len: usize) -> Result<(), DecodeError>
fn claim_container_read<T>(&mut self, len: usize) -> Result<(), DecodeError>
Claim that we’re going to read a container which contains
len entries of T.
This will correctly handle overflowing if len * size_of::<T>() > usize::max_value Read more