pub fn apply_second<'a, FA, A: 'a, B: 'a, Brand>(
fa: FA,
fb: <FA as ApplySecondDispatch<'a, Brand, A, B, <FA as InferableBrand_cdc7cd43dac7585f<'a, Brand, A>>::Marker>>::FB,
) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, B>where
Brand: Kind_cdc7cd43dac7585f,
FA: InferableBrand_cdc7cd43dac7585f<'a, Brand, A> + ApplySecondDispatch<'a, Brand, A, B, <FA as InferableBrand_cdc7cd43dac7585f<'a, Brand, A>>::Marker>,Expand description
Sequences two applicative actions, keeping the result of the second, inferring the brand from the container type.
The Brand type parameter is inferred from the concrete type of fa
via the InferableBrand trait. Both owned and borrowed containers are supported.
For types with multiple brands, use
explicit::apply_second with a turbofish.
§Type Signature
forall Brand A B. ApplySecond Brand => (Brand A, Brand B) -> Brand B
§Type Parameters
'a: The lifetime of the values.FA: The first container type (owned or borrowed). Brand is inferred from this.A: The type of the value(s) inside the first container.B: The type of the value(s) inside the second container.Brand: The brand, inferred via InferableBrand from FA and the element type.
§Parameters
fa: The first container (its values are discarded).fb: The second container (its values are preserved).
§Returns
A container preserving the values from the second input.
§Examples
use fp_library::functions::*;
assert_eq!(apply_second(Some(5), Some(10)), Some(10));
let a = Some(5);
let b = Some(10);
assert_eq!(apply_second(&a, &b), Some(10));