Skip to main content

IteratorContext

Trait IteratorContext 

Source
pub trait IteratorContext {
    // Required methods
    fn index(&self) -> i64;
    fn is_done(&self) -> bool;
    fn total(&self) -> Option<i64>;
}
Expand description

Object-safe view of an iterator’s current state, passed to every Callback hook.

The concrete iterator (e.g. Training) implements this privately; the callback only needs the interface.

Required Methods§

Source

fn index(&self) -> i64

Step index, zero-based. Matches the C++ Iterator::index().

Source

fn is_done(&self) -> bool

true when the iterator has finished all steps.

Source

fn total(&self) -> Option<i64>

Total planned steps, if known. None for open-ended iterators.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§