ApplySecond

Trait ApplySecond 

Source
pub trait ApplySecond: Lift {
    // Provided method
    fn apply_second<'a, A: 'a + Clone, B: 'a + Clone>(
        fa: <Self as Kind_c3c3610c70409ee6>::Of<'a, A>,
        fb: <Self as Kind_c3c3610c70409ee6>::Of<'a, B>,
    ) -> <Self as Kind_c3c3610c70409ee6>::Of<'a, B> { ... }
}
Expand description

A type class for types that support combining two contexts, keeping the second value.

ApplySecond provides the ability to sequence two computations but discard the result of the first computation, keeping only the result of the second.

Provided Methods§

Source

fn apply_second<'a, A: 'a + Clone, B: 'a + Clone>( fa: <Self as Kind_c3c3610c70409ee6>::Of<'a, A>, fb: <Self as Kind_c3c3610c70409ee6>::Of<'a, B>, ) -> <Self as Kind_c3c3610c70409ee6>::Of<'a, B>

Combines two contexts, keeping the value from the second context.

§Type Signature

forall a b. ApplySecond f => (f a, f b) -> f b

§Parameters
  • fa: The first context.
  • fb: The second context.
§Returns

The second context.

§Examples
use fp_library::classes::apply_second::ApplySecond;
use fp_library::brands::OptionBrand;

let x = Some(5);
let y = Some(10);
let z = OptionBrand::apply_second(x, y);
assert_eq!(z, Some(10));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§