Expand description
Dependency-light finite resource limits, budgets and pools.
A budget object always represents a configured finite constraint. When a
dimension is unconfigured, callers use Option::None and do not create a
no-op or unlimited budget object. Resource quantities use an exact unsigned
integer type. High-level limits remain generic so callers can preserve their
native measurements; conversions from machine-sized measurements are checked
and reported as resource-accounting errors.
A failed single-budget operation is non-mutating, and
ResourceBudget::try_consume_group checks every member before charging
any member. Higher-level sessions may deliberately retain charges for work
already attempted. Generic StructureBudget measurements are consumed
immediately, while JSON value measurements are staged and commit only after
the complete value succeeds. JSON raw and normalized input bytes, plus
accepted output prefixes, are charged immediately. These are separate
guarantees; an I/O failure does not itself poison a JSON value transaction,
and output transactionality does not imply whole-operation rollback.
Re-exports§
pub use string::BudgetedStringError;pub use string::BudgetedStringWriter;pub use structure::StructureBudget;pub use structure::StructureLimits;pub use structure::StructureLimitsBuilder;pub use structure::StructureResource;pub use time::DurationBudget;pub use time::TimeBudget;timepub use time::TimeBudgetError;time
Modules§
- json
json - Defines dependency-free resource limits and sessions for JSON processing.
- string
- Transactional string output helpers backed by finite resource budgets.
- structure
- Resource limits and budgets for nested structural data.
- time
- Finite budgets for explicit durations and continuous monotonic deadlines.
Structs§
- BigDecimal
Limits big-decimal - Composes coefficient limits with an absolute scale limit.
- BigDecimal
Limits Builder big-decimal - Builder for
BigDecimalLimits. - BigInteger
Limits big-integer - Optional point limits for one arbitrary-precision integer.
- BigInteger
Limits Builder big-integer - Builder for
BigIntegerLimits. - Budget
Group Error - Failure returned by an atomic grouped budget consumption.
- Insufficient
Budget Error - Structured facts for a cumulative request that exceeded remaining capacity.
- Limit
Exceeded Error - Structured facts for a point measurement that exceeded its maximum.
- Managed
Resource Permit - Owns acquired capacity and returns it to its pool when dropped.
- Managed
Resource Pool - A cloneable finite pool whose acquired capacity is owned by RAII permits.
- Quantity
Conversion Error - Error returned when a native measurement cannot fit the selected quantity.
- Resource
Budget - A finite, non-releasable resource budget.
- Resource
Limit - An inclusive immutable maximum for one resource measurement.
- Resource
Pool - A finite, non-synchronizing pool of releasable resource capacity.
- String
Limits - Optional point limit for one UTF-8 string’s byte length.
- String
Limits Builder - Builder for
StringLimits.
Enums§
- Budget
Error - Aggregate error for APIs that can perform both point and cumulative checks.
- Measured
Budget Error - Error returned when native measurement or budget validation rejects a value.
- Observation
- A resource observation that may be exact or only a safe lower bound.
- Quantity
Measurement - A native unsigned measurement whose value could not fit a resource quantity.
- Resource
Release Error - Structured facts describing a pool release that exceeds current usage.
Traits§
- Resource
Quantity - An exact, non-negative quantity accepted by resource budgets and pools.