pub trait CompactDispatch<'a, Brand: Kind_cdc7cd43dac7585f, A: 'a, Marker> {
// Required method
fn dispatch(self) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>;
}Expand description
Trait that routes a compact operation to the appropriate type class method.
The Marker type parameter is an implementation detail resolved by
the compiler from the container type; callers never specify it directly.
Owned containers resolve to Val, borrowed containers resolve to Ref.
§Type Parameters
Required Methods§
Sourcefn dispatch(self) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>
fn dispatch(self) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>
Perform the dispatched compact operation.
§Type Signature
self -> Brand A
§Returns
A new container with None values removed and Some values unwrapped.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
let result = compact::<VecBrand, _, _, _>(vec![Some(1), None, Some(3)]);
assert_eq!(result, vec![1, 3]);Implementors§
impl<'a, Brand, A> CompactDispatch<'a, Brand, A, Ref> for &<Brand as Kind_cdc7cd43dac7585f>::Of<'a, <OptionBrand as Kind_cdc7cd43dac7585f>::Of<'a, A>>where
Brand: RefCompactable,
A: 'a + Clone,
Routes borrowed containers to RefCompactable::ref_compact.
§Type Parameters
'a: The lifetime of the values.Brand: The brand of the compactable.A: The type of the value(s) inside theOptionwrappers.
impl<'a, Brand, A> CompactDispatch<'a, Brand, A, Val> for <Brand as Kind_cdc7cd43dac7585f>::Of<'a, <OptionBrand as Kind_cdc7cd43dac7585f>::Of<'a, A>>where
Brand: Compactable,
A: 'a,
Routes owned containers to Compactable::compact.
§Type Parameters
'a: The lifetime of the values.Brand: The brand of the compactable.A: The type of the value(s) inside theOptionwrappers.