(limit: usize)
| 61 | |
| 62 | impl ScopedBudget { |
| 63 | fn new(limit: usize) -> Self { |
| 64 | Self { |
| 65 | limit, |
| 66 | allocated: Arc::new(AtomicUsize::new(0)), |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /// Attempt a CAS-based reservation. Returns the `Arc` to the counter on |
| 71 | /// success so the token can hold a reference for drop-release. |