pub trait IteratorSpecImpl: Iterator {
// Required methods
exec fn obeys_prophetic_iter_laws(&self) -> bool;
exec fn remaining(&self) -> Seq<Self::Item>;
exec fn will_return_none(&self) -> bool;
exec fn decrease(&self) -> Option<nat>;
exec fn peek(&self, index: int) -> Option<Self::Item>;
}Required Methods§
Sourceexec fn obeys_prophetic_iter_laws(&self) -> bool
exec fn obeys_prophetic_iter_laws(&self) -> bool
This iterator obeys the specifications below on next,
expressed in terms of prophetic spec functions.
Only iterators that terminate (i.e., eventually return None
and then continue to return None) should use this interface.
Sourceexec fn remaining(&self) -> Seq<Self::Item>
exec fn remaining(&self) -> Seq<Self::Item>
Sequence of items that will (eventually) be returned
Sourceexec fn will_return_none(&self) -> bool
exec fn will_return_none(&self) -> bool
Does this iterator complete with a None after the above sequence?
(As opposed to hanging indefinitely on a next() call)
Trivially true for most iterators but important for iterators
that apply an exec closure that may not terminate.
Sourceexec fn decrease(&self) -> Option<nat>
exec 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.
Implementations on Foreign Types§
Source§impl<'a> IteratorSpecImpl for Chars<'a>
Available on verus_keep_ghost and crate feature alloc only.
impl<'a> IteratorSpecImpl for Chars<'a>
verus_keep_ghost and crate feature alloc only.Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<'a, K> IteratorSpecImpl for Iter<'a, K>
impl<'a, K> IteratorSpecImpl for Iter<'a, K>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<'a, K, V> IteratorSpecImpl for Iter<'a, K, V>
impl<'a, K, V> IteratorSpecImpl for Iter<'a, K, V>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<'a, K, V> IteratorSpecImpl for Keys<'a, K, V>
impl<'a, K, V> IteratorSpecImpl for Keys<'a, K, V>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<'a, K, V> IteratorSpecImpl for Values<'a, K, V>
impl<'a, K, V> IteratorSpecImpl for Values<'a, K, V>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<'a, K, V> IteratorSpecImpl for Iter<'a, K, V>
impl<'a, K, V> IteratorSpecImpl for Iter<'a, K, V>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<'a, K, V> IteratorSpecImpl for Keys<'a, K, V>
impl<'a, K, V> IteratorSpecImpl for Keys<'a, K, V>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<'a, K, V> IteratorSpecImpl for Values<'a, K, V>
impl<'a, K, V> IteratorSpecImpl for Values<'a, K, V>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<'a, T> IteratorSpecImpl for Iter<'a, T>
impl<'a, T> IteratorSpecImpl for Iter<'a, T>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<'a, T: 'a> IteratorSpecImpl for Iter<'a, T>
impl<'a, T: 'a> IteratorSpecImpl for Iter<'a, T>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<'a, T: 'a> IteratorSpecImpl for Iter<'a, T>
impl<'a, T: 'a> IteratorSpecImpl for Iter<'a, T>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<A: Step> IteratorSpecImpl for Range<A>
impl<A: Step> IteratorSpecImpl for Range<A>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§open spec fn remaining(&self) -> Seq<Self::Item>
open spec fn remaining(&self) -> Seq<Self::Item>
{
let steps = self.start.spec_steps_between_int(self.end);
let len = if steps > 0 { steps } else { 0 };
Seq::new(len as nat, |i: int| self.start.spec_forward_checked_int(i).unwrap())
}Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<A: Step> IteratorSpecImpl for RangeInclusive<A>
impl<A: Step> IteratorSpecImpl for RangeInclusive<A>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }Source§open spec fn remaining(&self) -> Seq<Self::Item>
open spec fn remaining(&self) -> Seq<Self::Item>
{
Seq::new(
(self@.start.spec_steps_between_int(self@.end) + 1) as nat,
|i: int| self@.start.spec_forward_checked_int(i).unwrap(),
)
}Source§uninterp spec fn will_return_none(&self) -> bool
uninterp spec fn will_return_none(&self) -> bool
Source§impl<I> IteratorSpecImpl for &mut Iwhere
I: Iterator,
impl<I> IteratorSpecImpl for &mut Iwhere
I: Iterator,
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ <I as IteratorSpec>::obeys_prophetic_iter_laws(*self) }Source§open spec fn will_return_none(&self) -> bool
open spec fn will_return_none(&self) -> bool
{ <I as IteratorSpec>::will_return_none(*self) }Source§impl<I> IteratorSpecImpl for Rev<I>where
I: DoubleEndedIterator + DoubleEndedIteratorSpec,
impl<I> IteratorSpecImpl for Rev<I>where
I: DoubleEndedIterator + DoubleEndedIteratorSpec,
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ rev_iter(*self).obeys_prophetic_iter_laws() }Source§closed spec fn will_return_none(&self) -> bool
closed spec fn will_return_none(&self) -> bool
Source§impl<T, A: Allocator> IteratorSpecImpl for IntoIter<T, A>
impl<T, A: Allocator> IteratorSpecImpl for IntoIter<T, A>
Source§open spec fn obeys_prophetic_iter_laws(&self) -> bool
open spec fn obeys_prophetic_iter_laws(&self) -> bool
{ true }