Trait Meter
pub trait Meter {
type Nested<'a>: Meter
where Self: 'a;
// Required methods
fn nest(&mut self) -> Result<Self::Nested<'_>, MeterError>;
fn charge(&mut self, amount: usize) -> Result<(), MeterError>;
}Expand description
A trait for tracking the resource limits consumed while serializing a value.
Required Associated Types§
Required Methods§
fn nest(&mut self) -> Result<Self::Nested<'_>, MeterError>
fn nest(&mut self) -> Result<Self::Nested<'_>, MeterError>
Produce a new meter for nested contexts, consuming one unit of nesting budget.
fn charge(&mut self, amount: usize) -> Result<(), MeterError>
fn charge(&mut self, amount: usize) -> Result<(), MeterError>
Charge amount units against the remaining size budget.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".