Skip to main content

Module compactable

Module compactable 

Source
Expand description

Data structures that can be compacted by filtering out None or separated by splitting Result values.

§Examples

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

let x = Some(Some(5));
let y = compact::<OptionBrand, _>(x);
assert_eq!(y, Some(5));

Traits§

Compactable
A type class for data structures that can be compacted and separated.

Functions§

compact
Compacts a data structure of Options, discarding None values and keeping Some values.
separate
Separates a data structure of Results into two data structures: one containing the Ok values and one containing the Err values.