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::Decode;
use bincode_next::de::DecoderImpl;
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 moreSource§fn decode_u16(&mut self) -> Result<u16, DecodeError>
fn decode_u16(&mut self) -> Result<u16, DecodeError>
Decode a
u16 value. Read moreSource§fn decode_u32(&mut self) -> Result<u32, DecodeError>
fn decode_u32(&mut self) -> Result<u32, DecodeError>
Decode a
u32 value. Read moreSource§fn decode_u64(&mut self) -> Result<u64, DecodeError>
fn decode_u64(&mut self) -> Result<u64, DecodeError>
Decode a
u64 value. Read moreSource§fn decode_u128(&mut self) -> Result<u128, DecodeError>
fn decode_u128(&mut self) -> Result<u128, DecodeError>
Decode a
u128 value. Read moreSource§fn decode_usize(&mut self) -> Result<usize, DecodeError>
fn decode_usize(&mut self) -> Result<usize, DecodeError>
Decode a
usize value. Read moreSource§fn decode_i16(&mut self) -> Result<i16, DecodeError>
fn decode_i16(&mut self) -> Result<i16, DecodeError>
Decode an
i16 value. Read moreSource§fn decode_i32(&mut self) -> Result<i32, DecodeError>
fn decode_i32(&mut self) -> Result<i32, DecodeError>
Decode an
i32 value. Read moreSource§fn decode_i64(&mut self) -> Result<i64, DecodeError>
fn decode_i64(&mut self) -> Result<i64, DecodeError>
Decode an
i64 value. Read moreSource§fn decode_i128(&mut self) -> Result<i128, DecodeError>
fn decode_i128(&mut self) -> Result<i128, DecodeError>
Decode an
i128 value. Read moreSource§fn decode_isize(&mut self) -> Result<isize, DecodeError>
fn decode_isize(&mut self) -> Result<isize, DecodeError>
Decode an
isize value. Read moreSource§fn decode_f32(&mut self) -> Result<f32, DecodeError>
fn decode_f32(&mut self) -> Result<f32, DecodeError>
Decode an
f32 value. Read moreSource§fn decode_f64(&mut self) -> Result<f64, DecodeError>
fn decode_f64(&mut self) -> Result<f64, DecodeError>
Decode an
f64 value. Read moreSource§fn decode_bool(&mut self) -> Result<bool, DecodeError>
fn decode_bool(&mut self) -> Result<bool, DecodeError>
Decode a
bool value. Read moreSource§fn decode_slice_len(&mut self) -> Result<usize, DecodeError>
fn decode_slice_len(&mut self) -> Result<usize, DecodeError>
Decode the length of a slice. Read more
Source§fn decode_array_len(&mut self) -> Result<usize, DecodeError>
fn decode_array_len(&mut self) -> Result<usize, DecodeError>
Decode the length of an array. Read more
Source§fn decode_map_len(&mut self) -> Result<usize, DecodeError>
fn decode_map_len(&mut self) -> Result<usize, DecodeError>
Decode the length of a map. Read more
Source§fn decode_variant_index(&mut self) -> Result<u32, DecodeError>
fn decode_variant_index(&mut self) -> Result<u32, DecodeError>
Decode an enum variant index. Read more
Source§fn decode_byte_slice_len(&mut self) -> Result<usize, DecodeError>
fn decode_byte_slice_len(&mut self) -> Result<usize, DecodeError>
Decode the length of a byte slice (Major Type 2 in CBOR). Read more
Source§fn decode_byte_slice_or_array_len(&mut self) -> Result<(u8, usize), DecodeError>
fn decode_byte_slice_or_array_len(&mut self) -> Result<(u8, usize), DecodeError>
Decode the length of a byte slice or an array (Major Type 2 or 4 in CBOR). Read more
Source§fn decode_str_len(&mut self) -> Result<usize, DecodeError>
fn decode_str_len(&mut self) -> Result<usize, DecodeError>
Decode the length of a string (Major Type 3 in CBOR). Read more
Source§fn decode_struct_header(&mut self, _len: usize) -> Result<(), DecodeError>
fn decode_struct_header(&mut self, _len: usize) -> Result<(), DecodeError>
Decode the header for a struct. Read more
Auto Trait Implementations§
impl<R, C, Context> Freeze for DecoderImpl<R, C, Context>
impl<R, C, Context> RefUnwindSafe for DecoderImpl<R, C, Context>
impl<R, C, Context> Send for DecoderImpl<R, C, Context>
impl<R, C, Context> Sync for DecoderImpl<R, C, Context>
impl<R, C, Context> Unpin for DecoderImpl<R, C, Context>
impl<R, C, Context> UnsafeUnpin for DecoderImpl<R, C, Context>
impl<R, C, Context> UnwindSafe for DecoderImpl<R, C, Context>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more