Skip to main content

ExtensionPolicy

Trait ExtensionPolicy 

Source
pub trait ExtensionPolicy: Send + Sync {
    // Required method
    fn next_extension(&self, ctx: &ExtensionContext) -> Option<u64>;
}
Expand description

Policy that decides whether to extend an ExtendingRangeSource when its current end is reached.

Implementations are pure predicates over the ExtensionContext — no internal state, no side effects. The source provides elapsed time and consumed counts; the policy returns Some(delta) to grow the extent or None to terminate. Cheap-and-possibly-duplicated call contract (concurrent fibers may invoke under racing end-reach; only one CAS-wins extension takes effect per round).

Required Methods§

Source

fn next_extension(&self, ctx: &ExtensionContext) -> Option<u64>

Decide how to extend (if at all) given the current cursor context.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§