Skip to main content

IteratorSpec

Trait IteratorSpec 

Source
pub trait IteratorSpec: Iterator {
    // Required methods
    spec fn obeys_prophetic_iter_laws(&self) -> bool;
    spec fn remaining(&self) -> Seq<Self::Item>;
    spec fn produces(&self) -> Seq<bool>;
    spec fn decrease(&self) -> Option<nat>;
    spec fn peek(&self, index: int) -> Option<Self::Item>;
}

Required Methods§

Source

spec fn obeys_prophetic_iter_laws(&self) -> bool

This iterator obeys the specifications below on next, expressed in terms of prophetic spec functions. Only finite iterators (i.e., those that eventually return None and then continue to return None) or infinite iterators that never return None should use this interface.

Source

spec fn remaining(&self) -> Seq<Self::Item>

Sequence of all potentially returned items

Source

spec fn produces(&self) -> Seq<bool>

For each potential item in remaining(), does the item actually get returned, or does the iterator get “stuck” trying to produce it, e.g., because a client supplied a closure that diverges?

Source

spec fn decrease(&self) -> Option<nat>

Value used by default for the decreases clause when no explicit decreases clause is provided (the user can override this with an explicit decreases clause). If there’s no appropriate metric to decrease, this can return None, and the user will have to provide an explicit decreases clause.

Source

spec fn peek(&self, index: int) -> Option<Self::Item>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<VERUS_SPEC__A: Iterator + ?Sized> IteratorSpec for VERUS_SPEC__A