rs-budget
Dependency-light resource limit and budget accounting primitives for Qubit Rust crates.
Intended Users
Rust library authors who need to enforce bounded input, output, depth, node, or item work while keeping domain-specific policies and diagnostics in their own crates.
Installation
Add the published crate to your Cargo.toml:
[]
= "0.1"
Quick Start
use ResourceLimit;
let mut budget = new.budget;
budget.consume.expect;
assert_eq!;
Capabilities
- immutable single-dimension limits through
ResourceLimit; - mutable per-operation accounting through
ResourceBudget; - typed
LimitExceeded<K>facts for domain-owned resource categories; - saturating usage arithmetic and failure-atomic consumption.
Limitations
The crate intentionally does not define JSON, Serde, I/O, redaction, parser,
default-limit, or domain-error policy. Consuming crates should retain their own
public limit types and translate LimitExceeded<K> into their established
errors.
Testing
# Run tests with the default feature set
# Run tests with all declared features
# Project CI checks
# Check code coverage
License
Copyright (c) 2025 - 2026. Haixing Hu. All rights reserved.
Licensed under the Apache License, Version 2.0. See LICENSE for the full license text.
Contributing
Contributions are welcome. Please follow the Rust API guidelines, keep public
API documentation and tests current, and run ./align-ci.sh to format code and
./ci-check.sh to satisfy CI requirements before submitting a pull request.
Author
Haixing Hu - Qubit Co. Ltd.
Repository: https://github.com/qubit-ltd/rs-budget