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. The source consults the policy under its round lock, so calls never overlap; a reader that finds the end reached after another reader’s None consults it again.

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§