pub struct CaptureLedger { /* private fields */ }Expand description
Monotone per-run ledger. Reservations cannot be refunded after work begins.
Implementations§
Source§impl CaptureLedger
impl CaptureLedger
Sourcepub fn new(plan: &AdmittedCapturePlan) -> Self
pub fn new(plan: &AdmittedCapturePlan) -> Self
Creates a fresh run ledger with the admitted limits.
Sourcepub fn with_inherited_usage(
plan: &AdmittedCapturePlan,
inherited: CaptureUsage,
) -> Result<Self, CaptureError>
pub fn with_inherited_usage( plan: &AdmittedCapturePlan, inherited: CaptureUsage, ) -> Result<Self, CaptureError>
Starts an independently admitted child ledger with the usage already consumed at its fork boundary. Inherited usage counts against the child’s cumulative limits, but not its next step. Later parent work is separate.
Sourcepub fn begin_step(&mut self)
pub fn begin_step(&mut self)
Resets step reservations while preserving cumulative accounting.
Sourcepub fn step(&self) -> CaptureUsage
pub fn step(&self) -> CaptureUsage
Returns current step reservations.
Sourcepub fn total(&self) -> CaptureUsage
pub fn total(&self) -> CaptureUsage
Returns cumulative reservations.
Sourcepub fn reserve(
&mut self,
usage: CaptureUsage,
) -> Result<Option<CaptureSkipReason>, CaptureError>
pub fn reserve( &mut self, usage: CaptureUsage, ) -> Result<Option<CaptureSkipReason>, CaptureError>
Charges a conservative reservation before native work; skipped reservations are not charged.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CaptureLedger
impl RefUnwindSafe for CaptureLedger
impl Send for CaptureLedger
impl Sync for CaptureLedger
impl Unpin for CaptureLedger
impl UnsafeUnpin for CaptureLedger
impl UnwindSafe for CaptureLedger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more