Struct bincode::de::DecoderImpl
source · [−]pub struct DecoderImpl<R, C: Config> { /* 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::de::{DecoderImpl, Decode};
let mut decoder = DecoderImpl::new(some_reader, bincode::config::standard());
// this u32 can be any Decode
let value = u32::decode(&mut decoder).unwrap();Implementations
sourceimpl<R: Reader, C: Config> DecoderImpl<R, C>
impl<R: Reader, C: Config> DecoderImpl<R, C>
sourcepub fn new(reader: R, config: C) -> DecoderImpl<R, C>
pub fn new(reader: R, config: C) -> DecoderImpl<R, C>
Construct a new Decoder
Trait Implementations
sourceimpl<'de, R: BorrowReader<'de>, C: Config> BorrowDecoder<'de> for DecoderImpl<R, C>
impl<'de, R: BorrowReader<'de>, C: Config> BorrowDecoder<'de> for DecoderImpl<R, C>
type BR = R
type BR = R
The concrete BorrowReader type
sourcefn borrow_reader(&mut self) -> &mut Self::BR
fn borrow_reader(&mut self) -> &mut Self::BR
Rerturns a mutable reference to the borrow reader
sourceimpl<R: Reader, C: Config> Decoder for DecoderImpl<R, C>
impl<R: Reader, C: Config> Decoder for DecoderImpl<R, C>
sourcefn 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 more
sourcefn 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 more
sourcefn 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
Auto Trait Implementations
impl<R, C> RefUnwindSafe for DecoderImpl<R, C> where
C: RefUnwindSafe,
R: RefUnwindSafe,
impl<R, C> Send for DecoderImpl<R, C> where
C: Send,
R: Send,
impl<R, C> Sync for DecoderImpl<R, C> where
C: Sync,
R: Sync,
impl<R, C> Unpin for DecoderImpl<R, C> where
C: Unpin,
R: Unpin,
impl<R, C> UnwindSafe for DecoderImpl<R, C> where
C: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more