pub trait ApplySecondDispatch<'a, Brand: Kind_cdc7cd43dac7585f, A: 'a, B: 'a, Marker> {
type FB;
// Required method
fn dispatch(
self,
fb: Self::FB,
) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, B>;
}Expand description
Trait that routes an apply_second 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 Associated Types§
Required Methods§
Sourcefn dispatch(self, fb: Self::FB) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, B>
fn dispatch(self, fb: Self::FB) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, B>
Perform the dispatched apply_second operation.
§Type Signature
(self, Self) -> Brand B
§Parameters
self: The first container implementing this dispatch.fb: The second container (its result is kept).
§Returns
A container preserving the values from the second input.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
let result = apply_second::<OptionBrand, _, _, _, _>(Some(5), Some(10));
assert_eq!(result, Some(10));Implementors§
Source§impl<'a, 'b, Brand, A, B> ApplySecondDispatch<'a, Brand, A, B, Ref> for &'b <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>where
Brand: RefApplySecond,
A: 'a,
B: 'a + Clone,
'a: 'b,
Routes borrowed containers to RefApplySecond::ref_apply_second.
impl<'a, 'b, Brand, A, B> ApplySecondDispatch<'a, Brand, A, B, Ref> for &'b <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>where
Brand: RefApplySecond,
A: 'a,
B: 'a + Clone,
'a: 'b,
Routes borrowed containers to RefApplySecond::ref_apply_second.
§Type Parameters
'a: The lifetime of the values.'b: The borrow lifetime.Brand: The brand of the applicative.A: The type of the value(s) inside the first container.B: The type of the value(s) inside the second container.
type FB = &'b <Brand as Kind_cdc7cd43dac7585f>::Of<'a, B>
Source§impl<'a, Brand, A, B> ApplySecondDispatch<'a, Brand, A, B, Val> for <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>
Routes owned containers to ApplySecond::apply_second.
impl<'a, Brand, A, B> ApplySecondDispatch<'a, Brand, A, B, Val> for <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>
Routes owned containers to ApplySecond::apply_second.
§Type Parameters
'a: The lifetime of the values.Brand: The brand of the applicative.A: The type of the value(s) inside the first container.B: The type of the value(s) inside the second container.