Skip to main content

Policy

Trait Policy 

Source
pub trait Policy {
    // Required method
    fn should_continue(&self, context: &dyn Context<'_>) -> bool;

    // Provided method
    fn should_seek_begin(&self) -> bool { ... }
}
Expand description

Policy for controlling iterator behavior

This trait defines how iterators should behave during iteration, including when to stop and whether to seek to the beginning at start.

Required Methods§

Source

fn should_continue(&self, context: &dyn Context<'_>) -> bool

Determines if iteration should continue based on current context

Provided Methods§

Source

fn should_seek_begin(&self) -> bool

Determines if iterator should seek to beginning at start, default is true

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§