Skip to main content

UsageSlot

Trait UsageSlot 

Source
pub trait UsageSlot: Send + 'static {
    // Required method
    fn record(self, event: UsageEvent);
}
Expand description

Pre-reserved capacity for exactly one usage event.

Implementations must record without fallible I/O: obtaining a slot is the backpressure decision, while consuming it is the committed-charge path.

Required Methods§

Source

fn record(self, event: UsageEvent)

Record the charge into the capacity this slot reserved. Called from the committed guard’s drop, so it must not block, allocate fallibly or fail.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§