Trait options_results::ResultIter
[−]
[src]
pub trait ResultIter: Iterator where Self: Sized, Self::Item: _ResultTrait {
fn unwrap(self) -> Unwrap<Self> { ... }
fn unwrap_or(self, def: Self::Item::Type) -> UnwrapOr<Self> { ... }
fn count_ok(self) -> usize { ... }
fn count_err(self) -> usize { ... }
fn count_ok_err(self) -> (usize, usize) { ... }
fn find_ok(&mut self) -> Option<Self::Item::Type> { ... }
fn find_err(&mut self) -> Option<Self::Item::ErrType> { ... }
fn has_ok(&mut self) -> bool { ... }
fn has_err(&mut self) -> bool { ... }
fn ok_iter(self) -> OkIter<Self> { ... }
fn err_iter(self) -> ErrIter<Self> { ... }
}
Add some methods for the iterator of Result<T, E>
.
Provided Methods
fn unwrap(self) -> Unwrap<Self>
Create an iterator which yields the unwrapped value as the next value.
(Unwrap<I>::next()
will panic if the value is Err(_)
.)
fn unwrap_or(self, def: Self::Item::Type) -> UnwrapOr<Self>
Create an iterator which yields the unwrapped value or a default as the next value.
fn count_ok(self) -> usize
Count the number of Ok(_)
in this iterator.
fn count_err(self) -> usize
Count the number of Err(_)
in this iterator.
fn count_ok_err(self) -> (usize, usize)
Count the number of Ok(_)
and Err(_)
in this iterator.
Return a tuple as (number of Ok value, number of Err value)
fn find_ok(&mut self) -> Option<Self::Item::Type>
Searches for an element of an iterator that the value is Ok(_)
.
If each element of the iterator all equal Err(_)
, it returns None
.
fn find_err(&mut self) -> Option<Self::Item::ErrType>
Searches for an element of an iterator that the value is Err(_)
.
If each element of the iterator all equal Ok(_)
, it returns None
.
fn has_ok(&mut self) -> bool
Tests if any element of the iterator are Ok(_)
.
fn has_err(&mut self) -> bool
Tests if any element of the iterator are Err(_)
.
fn ok_iter(self) -> OkIter<Self>
Create an iterator which yields unwrapped Ok(_)
value.
fn err_iter(self) -> ErrIter<Self>
Create an iterator which yields unwrapped Err(_)
value.