Trait try_map::FallibleMapExt
[−]
[src]
pub trait FallibleMapExt<T, U, E> {
fn try_map<F>(self, f: F) -> Result<Option<U>, E>
where
F: FnOnce(T) -> Result<U, E>;
}Extend Option with a fallible map method
This is useful for mapping fallible operations (i.e. operations that)
return Result, over an optional type. The result will be
Result<Option<U>>, which makes it easy to handle the errors that
originate from inside the closure that's being mapped.
Type parameters
T: The inputOption's value typeU: The outputsOption's value typeE: The possible error during the mapping
Required Methods
fn try_map<F>(self, f: F) -> Result<Option<U>, E> where
F: FnOnce(T) -> Result<U, E>,
F: FnOnce(T) -> Result<U, E>,
Try to apply a fallible map function to the option