Skip to main content

Module compactable

Module compactable 

Source
Expand description

Dispatch for compactable operations: Compactable and RefCompactable.

Provides the following dispatch traits and unified free functions:

Each routes to the appropriate trait method based on whether the container is owned or borrowed.

§Examples

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

// compact
let y = compact::<VecBrand, _, _, _>(vec![Some(1), None, Some(3)]);
assert_eq!(y, vec![1, 3]);

// separate
let (errs, oks) = separate::<VecBrand, _, _, _, _>(vec![Ok(1), Err(2), Ok(3)]);
assert_eq!(oks, vec![1, 3]);
assert_eq!(errs, vec![2]);

Modules§

explicit
Explicit dispatch functions requiring a Brand turbofish.

Traits§

CompactDispatch
Trait that routes a compact operation to the appropriate type class method.
SeparateDispatch
Trait that routes a separate operation to the appropriate type class method.

Functions§

compact
Removes None values from a container of Options, inferring the brand from the container type.
separate
Separates a container of Result values into two containers, inferring the brand from the container type.