Trait libimagutil::iter::FoldResult
[−]
[src]
pub trait FoldResult: Sized { type Item; fn fold_result<R, E, F>(self, func: F) -> Result<(), E>
where
F: FnMut(Self::Item) -> Result<R, E>; }
Folds its contents to a result.
Associated Types
type Item
Required Methods
fn fold_result<R, E, F>(self, func: F) -> Result<(), E> where
F: FnMut(Self::Item) -> Result<R, E>,
F: FnMut(Self::Item) -> Result<R, E>,
Apply a FnMut(Self::Item) -> Result<R, E>
to each item. If each
application returns an Ok(_)
, return Ok(())
, indicating success.
Otherwise return the first error.
The return type of this function only indicates success with the
Ok(())
idiom. To retrieve the values of your application, include an
accumulator in func
. This is the intended reason for the permissive
FnMut
type.
Implementors
impl<X, I: Iterator<Item = X>> FoldResult for I