Class Subspace :: sus :: iter :: Peekable

template <class InnerSizedIter>
class Peekable final
{ ... };

An iterator with a peek() that returns an optional reference to the next element.

This type is returned from Iterator::peekable().

Methods

auto clone() const -> Peekable<InnerSizedIter>
requires
sus::mem::Clone<InnerSizedIter>
sus::mem::CloneOrRef<Item>

sus::mem::Clone implementation

auto exact_size_hint() const -> sus::usize
requires
sus::iter::ExactSizeIterator<InnerSizedIter, Item>

sus::iter::ExactSizeIterator trait.

auto next() -> Option<sus::iter::Peekable::Item>

sus::iter::Iterator trait.

auto next_back() -> Option<sus::iter::Peekable::Item>
requires
sus::iter::DoubleEndedIterator<InnerSizedIter, Item>

sus::iter::DoubleEndedIterator trait.

auto next_if(FnOnce<bool(const std::remove_reference_t<sus::iter::Peekable::Item>&)> auto pred) -> Option<sus::iter::Peekable::Item>

Consume and return the next value of this iterator if a condition is true.

If func returns true for the next value of this iterator, consume and return it. Otherwise, return None.

auto next_if_eq(const std::remove_reference_t<sus::iter::Peekable::Item>& expected) -> Option<sus::iter::Peekable::Item>
requires
sus::cmp::Eq<Item>

Consume and return the next item if it is equal to expected.

auto peek() -> Option<const std::remove_reference_t<sus::iter::Peekable::Item>&>

Returns a const reference to the next() value without advancing the iterator.

Like next(), if there is a value, it is wrapped in a Some(T). But if the iteration is over, None is returned.

auto peek_mut() -> Option<sus::iter::Peekable::Item&>

Returns a mutable reference to the next() value without advancing the iterator.

Like next(), if there is a value, it is wrapped in a Some(T). But if the iteration is over, None is returned.

auto size_hint() const -> SizeHint

sus::iter::Iterator trait.

auto trusted_len() const -> sus::iter::__private::TrustedLenMarker
requires
sus::iter::TrustedLen<InnerSizedIter>

sus::iter::TrustedLen trait.

Operators

auto operator=(Peekable<InnerSizedIter>&&) -> Peekable<InnerSizedIter>&