Skip to main content

Crate budget_context

Crate budget_context 

Source
Expand description

Hierarchical, process-local resource budgets for concurrent Rust task trees.

A Budget accounts for arbitrary integer-valued Resources. Child budgets may add tighter limits, while every successful operation is also recorded against every ancestor. Reservation and ReservationSet provide cancellation-safe capacity claims which release on drop.

The crate is cooperative: code must receive and consult a budget for it to be constrained. It is not a security sandbox, rate limiter, billing ledger, or distributed quota service.

Structs§

Budget
A cloneable handle to one node in a hierarchical resource budget.
BudgetBuilder
Builder for a root or child Budget.
BudgetId
A process-local identifier for a budget node.
BudgetSnapshot
A consistent read-only view of a budget node.
Reservation
A cancellation-safe reservation for one resource.
ReservationSet
An atomic, cancellation-safe reservation for several resources.
Resource
An application-defined resource category.
ResourceSnapshot
A consistent read-only view of one resource at a budget node.

Enums§

BudgetBuildError
Error returned when building a budget node.
BudgetError
Error returned by accounting and execution operations.
Remaining
Effective remaining capacity for a resource.
ResourceError
Error returned when constructing a resource.