Expand description
§extra-result
Add extra methods to Result by use a trait ExtraResult.
Current methods added is
map_futmap_or_futmap_or_else_futmap_err_futinspect_futinspect_err_futand_then_futor_else_futunwrap_or_else_futis_ok_and_futis_err_and_fut
All these methods is a mirror of a method of regular Result but it accept async function instead.
§How to use.
Simply add use extra_result::*; to a source file that going to use above methods.
Note: The crate only provide single trait name ExtraResult. It is also possible to use extra_result::ExtraResult; instead of using wildcard but it won’t make any different.
Traits§
- Extra
Result - Add extra functionalities to the Result type. This trait provides a set of async versions of the standard Result methods. Unlike the standard methods, these methods accept async functions as arguments. It return a Future that resolves to the same result of standard Result counterpart. Unless async functions is needed, it is recommended to use the standard Result methods for performance reason.