Skip to main content

Crate qubit_budget

Crate qubit_budget 

Source
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;time
pub use time::TimeBudgetError;time

Modules§

jsonjson
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§

BigDecimalLimitsbig-decimal
Composes coefficient limits with an absolute scale limit.
BigDecimalLimitsBuilderbig-decimal
Builder for BigDecimalLimits.
BigIntegerLimitsbig-integer
Optional point limits for one arbitrary-precision integer.
BigIntegerLimitsBuilderbig-integer
Builder for BigIntegerLimits.
BudgetGroupError
Failure returned by an atomic grouped budget consumption.
InsufficientBudgetError
Structured facts for a cumulative request that exceeded remaining capacity.
LimitExceededError
Structured facts for a point measurement that exceeded its maximum.
ManagedResourcePermit
Owns acquired capacity and returns it to its pool when dropped.
ManagedResourcePool
A cloneable finite pool whose acquired capacity is owned by RAII permits.
QuantityConversionError
Error returned when a native measurement cannot fit the selected quantity.
ResourceBudget
A finite, non-releasable resource budget.
ResourceLimit
An inclusive immutable maximum for one resource measurement.
ResourcePool
A finite, non-synchronizing pool of releasable resource capacity.
StringLimits
Optional point limit for one UTF-8 string’s byte length.
StringLimitsBuilder
Builder for StringLimits.

Enums§

BudgetError
Aggregate error for APIs that can perform both point and cumulative checks.
MeasuredBudgetError
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.
QuantityMeasurement
A native unsigned measurement whose value could not fit a resource quantity.
ResourceReleaseError
Structured facts describing a pool release that exceeds current usage.

Traits§

ResourceQuantity
An exact, non-negative quantity accepted by resource budgets and pools.