Expand description
Dispatch for witherable operations:
Witherable and
RefWitherable.
Provides the following dispatch traits and unified free functions:
Each routes to the appropriate trait method based on the closure’s argument type.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
types::*,
};
// wilt
let y = wilt::<RcFnBrand, OptionBrand, OptionBrand, _, _, _, _, _>(
|a: i32| Some(if a > 2 { Ok(a) } else { Err(a) }),
Some(5),
);
assert_eq!(y, Some((None, Some(5))));
// wither
let y = wither::<RcFnBrand, OptionBrand, OptionBrand, _, _, _, _>(
|a: i32| Some(if a > 2 { Some(a * 2) } else { None }),
Some(5),
);
assert_eq!(y, Some(Some(10)));Modules§
- explicit
- Explicit dispatch functions requiring a Brand turbofish.
Traits§
- Wilt
Dispatch - Trait that routes a wilt operation to the appropriate type class method.
- Wither
Dispatch - Trait that routes a wither operation to the appropriate type class method.