pub trait PartitionDispatch<'a, Brand: Kind_cdc7cd43dac7585f, A: 'a + Clone, FA, Marker> {
// Required method
fn dispatch(
self,
fa: FA,
) -> (<Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>);
}Expand description
Trait that routes a partition operation to the appropriate type class method.
The Marker type parameter is an implementation detail resolved by
the compiler from the closure’s argument type; callers never specify
it directly. The FA type parameter is inferred from the container
argument: owned for Val dispatch, borrowed for Ref dispatch.
§Type Parameters
Required Methods§
Sourcefn dispatch(
self,
fa: FA,
) -> (<Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>)
fn dispatch( self, fa: FA, ) -> (<Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>)
Perform the dispatched partition operation.
§Type Signature
(self, FA) -> (Brand A, Brand A)
§Parameters
self: The closure implementing this dispatch.fa: The filterable instance containing the value(s).
§Returns
A tuple of two filterable instances: the first contains elements satisfying the predicate, the second contains the rest.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
let (no, yes) = partition::<OptionBrand, _, _, _>(|x: i32| x > 3, Some(5));
assert_eq!(yes, Some(5));
assert_eq!(no, None);Implementors§
impl<'a, 'b, Brand, A, F> PartitionDispatch<'a, Brand, A, &'b <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>, Ref> for F
Routes Fn(&A) -> bool closures to RefFilterable::ref_partition.
The container must be passed by reference (&fa).
§Type Parameters
'a: The lifetime of the values.'b: The borrow lifetime.Brand: The brand of the filterable.A: The type of the value(s) inside the filterable.F: The closure type.
impl<'a, Brand, A, F> PartitionDispatch<'a, Brand, A, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>, Val> for F
Routes Fn(A) -> bool closures to Filterable::partition.
§Type Parameters
'a: The lifetime of the values.Brand: The brand of the filterable.A: The type of the value(s) inside the filterable.F: The closure type.