Skip to main content

Module ref_traversable

Module ref_traversable 

Source
Expand description

By-reference traversal of structures.

§Examples

use fp_library::{
	brands::*,
	functions::*,
};

let v = vec![1, 2, 3];
let result: Option<Vec<String>> =
	ref_traverse::<VecBrand, RcFnBrand, _, _, OptionBrand>(|x: &i32| Some(x.to_string()), &v);
assert_eq!(result, Some(vec!["1".to_string(), "2".to_string(), "3".to_string()]));

Traits§

RefTraversable
By-reference traversal of structures.

Functions§

ref_traverse
Maps each element by reference to a computation, evaluates them, and combines the results.