Skip to main content

Module ref_filterable

Module ref_filterable 

Source
Expand description

By-reference filtering and partitioning of structures.

§Examples

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

let v = vec![1, 2, 3, 4, 5];
let result =
	filter_map::<VecBrand, _, _, _, _>(|x: &i32| if *x > 3 { Some(*x) } else { None }, &v);
assert_eq!(result, vec![4, 5]);

Traits§

RefFilterable
By-reference filtering of structures.

Functions§

ref_filter
Filters by reference using a predicate.
ref_filter_map
Maps by reference and filters out None results.
ref_partition
Partitions by reference using a predicate.
ref_partition_map
Partitions by reference using a function returning Result.