pub struct DecodeAccumulator { /* private fields */ }Expand description
Stateful budget accounting for one decoder invocation.
Implementations§
Source§impl DecodeAccumulator
impl DecodeAccumulator
Sourcepub const fn limits(&self) -> DecodeLimits
pub const fn limits(&self) -> DecodeLimits
Returns the active decode limits.
Sourcepub const fn total_allocated(&self) -> usize
pub const fn total_allocated(&self) -> usize
Returns the cumulative allocation accounted so far.
Sourcepub fn check_input_len(&self, len: usize) -> Result<(), DecodeError>
pub fn check_input_len(&self, len: usize) -> Result<(), DecodeError>
Validates the input length before parsing starts.
Sourcepub fn check_list_count(&self, count: usize) -> Result<(), DecodeError>
pub fn check_list_count(&self, count: usize) -> Result<(), DecodeError>
Validates a decoded list item count.
Sourcepub fn check_nesting_depth(&self, depth: usize) -> Result<(), DecodeError>
pub fn check_nesting_depth(&self, depth: usize) -> Result<(), DecodeError>
Validates the current nesting depth.
Sourcepub fn check_allocation(&mut self, size: usize) -> Result<(), DecodeError>
pub fn check_allocation(&mut self, size: usize) -> Result<(), DecodeError>
Accounts for one allocation against the cumulative allocation budget.
Trait Implementations§
Source§impl Debug for DecodeAccumulator
impl Debug for DecodeAccumulator
impl Eq for DecodeAccumulator
Source§impl PartialEq for DecodeAccumulator
impl PartialEq for DecodeAccumulator
Source§fn eq(&self, other: &DecodeAccumulator) -> bool
fn eq(&self, other: &DecodeAccumulator) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DecodeAccumulator
Auto Trait Implementations§
impl Freeze for DecodeAccumulator
impl RefUnwindSafe for DecodeAccumulator
impl Send for DecodeAccumulator
impl Sync for DecodeAccumulator
impl Unpin for DecodeAccumulator
impl UnsafeUnpin for DecodeAccumulator
impl UnwindSafe for DecodeAccumulator
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