Expand description
Dispatch for Traversable::traverse and
RefTraversable::ref_traverse.
Provides the TraverseDispatch trait and a unified explicit::traverse free
function that routes to the appropriate trait method based on the closure’s
argument type.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
// Owned: dispatches to Traversable::traverse
let y =
traverse::<RcFnBrand, OptionBrand, _, _, OptionBrand, _, _>(|x: i32| Some(x * 2), Some(5));
assert_eq!(y, Some(Some(10)));
// By-ref: dispatches to RefTraversable::ref_traverse
let y = traverse::<RcFnBrand, OptionBrand, _, _, OptionBrand, _, _>(
|x: &i32| Some(*x * 2),
&Some(5),
);
assert_eq!(y, Some(Some(10)));Modules§
- explicit
- Explicit dispatch functions requiring a Brand turbofish.
Traits§
- Traverse
Dispatch - Trait that routes a traverse operation to the appropriate type class method.
Functions§
- traverse
- Traverses a structure, inferring the brand from the container type.