pub struct VecDecoderWith<D: Decoder + Default> { /* private fields */ }Expand description
A decoder for a compact sized length-prefixed vector of items, generic over the item decoder type.
When the item count is known from context rather than a length prefix, use
ExactVecDecoderWith instead.
Implementations§
Source§impl<D: Decoder + Default> VecDecoderWith<D>
impl<D: Decoder + Default> VecDecoderWith<D>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Constructs a new decoder with the default limit of 4,000,000 elements.
Sourcepub const fn new_with_limit(limit: usize) -> Self
pub const fn new_with_limit(limit: usize) -> Self
Constructs a new decoder with a custom element limit.
Trait Implementations§
Source§impl<D: Decoder + Default + Clone> Clone for VecDecoderWith<D>
Available on crate feature alloc only.
impl<D: Decoder + Default + Clone> Clone for VecDecoderWith<D>
Available on crate feature
alloc only.Source§impl<D: Decoder + Default + Debug> Debug for VecDecoderWith<D>
Available on crate feature alloc only.
impl<D: Decoder + Default + Debug> Debug for VecDecoderWith<D>
Available on crate feature
alloc only.Source§impl<D: Decoder + Default> Decoder for VecDecoderWith<D>
Available on crate feature alloc only.
impl<D: Decoder + Default> Decoder for VecDecoderWith<D>
Available on crate feature
alloc only.Source§type Output = Vec<<D as Decoder>::Output>
type Output = Vec<<D as Decoder>::Output>
The type that this decoder produces when decoding is complete.
Source§type Error = VecDecoderError<<D as Decoder>::Error>
type Error = VecDecoderError<<D as Decoder>::Error>
The error type that this decoder can produce.
Source§fn push_bytes(
&mut self,
bytes: &mut &[u8],
) -> Result<DecoderStatus, Self::Error>
fn push_bytes( &mut self, bytes: &mut &[u8], ) -> Result<DecoderStatus, Self::Error>
Pushes bytes into the decoder, consuming as much as possible. Read more
Source§fn end(self) -> Result<Self::Output, Self::Error>
fn end(self) -> Result<Self::Output, Self::Error>
Completes the decoding process and returns the final result. Read more
Source§fn read_limit(&self) -> usize
fn read_limit(&self) -> usize
Returns the maximum number of bytes this decoder can consume without over-reading. Read more
Auto Trait Implementations§
impl<D> Freeze for VecDecoderWith<D>where
D: Freeze,
impl<D> RefUnwindSafe for VecDecoderWith<D>
impl<D> Send for VecDecoderWith<D>
impl<D> Sync for VecDecoderWith<D>
impl<D> Unpin for VecDecoderWith<D>
impl<D> UnsafeUnpin for VecDecoderWith<D>where
D: UnsafeUnpin,
impl<D> UnwindSafe for VecDecoderWith<D>
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