Trait options_results::OptionIter
[−]
[src]
pub trait OptionIter<T>: Iterator<Item = Option<T>> where
Self: Sized, { fn unwrap(self) -> Unwrap<Self, T> { ... } fn unwrap_or(self, def: T) -> UnwrapOr<Self, T> { ... } fn count_some(self) -> usize { ... } fn find_some(&mut self) -> Option<T> { ... } fn has_some(&mut self) -> bool { ... } fn has_none(&mut self) -> bool { ... } fn some_iter(self) -> SomeIter<Self, T> { ... } }
Add some methods for the iterator of Option<T>
.
Provided Methods
fn unwrap(self) -> Unwrap<Self, T>
Create an iterator which yields the unwrapped value as the next value.
(Unwrap<I>::next()
will panic if the value is None
.)
fn unwrap_or(self, def: T) -> UnwrapOr<Self, T>
Create an iterator which yields the unwrapped value or a default as the next value.
fn count_some(self) -> usize
Count the number of Some(_)
in this iterator.
fn find_some(&mut self) -> Option<T>
Searches for an element of an iterator that the value is Some(_)
.
If each element of the iterator all equal None
, it returns None
.
fn has_some(&mut self) -> bool
Tests if any element of the iterator are Some(_)
.
fn has_none(&mut self) -> bool
Tests if any element of the iterator are None
.
fn some_iter(self) -> SomeIter<Self, T>
Create an iterator which yields unwrapped Some(_)
value.