Skip to main content

ProviderCallLedger

Trait ProviderCallLedger 

Source
pub trait ProviderCallLedger: Send + Sync {
    // Required methods
    fn charged(&self);
    fn refunded(&self);
}
Expand description

Observes every change to one shared provider-call pool, so a host can persist spending across process restarts.

A charge is reported after a call leaves the pool, including the initial call held by a reservation. A refund is reported before an unused reservation returns its call, so a returned call is never charged again ahead of its refund. Charges minus refunds therefore never exceed the calls spent, and equal them once accounting is idle. Implementations must not block; they run inside budget accounting.

Required Methods§

Source

fn charged(&self)

One call left the shared pool.

Source

fn refunded(&self)

One unused reserved call returned to the shared pool.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§