Skip to main content

ApplySecond

Trait ApplySecond 

Source
pub trait ApplySecond: Lift {
    // Provided method
    fn apply_second<'a, A: 'a + Clone, B: 'a + Clone>(
        fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
        fb: <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>,
    ) -> <Self as Kind_cdc7cd43dac7585f>::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_cdc7cd43dac7585f>::Of<'a, A>, fb: <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>

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

This function sequences two computations and discards the result of the first computation, keeping only the result of the second.

§Type Signature

forall A B. (Self A, Self B) -> Self B

§Type Parameters
  • 'a: The lifetime of the values.
  • A: The type of the value in the first context.
  • B: The type of the value in the second context.
§Parameters
  • fa: The first context.
  • fb: The second context.
§Returns

The second context.

§Examples
use fp_library::{
	brands::*,
	functions::*,
};

let x = Some(5);
let y = Some(10);
let z = apply_second::<OptionBrand, _, _>(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§

Source§

impl ApplySecond for CatListBrand

Source§

impl ApplySecond for IdentityBrand

Source§

impl ApplySecond for OptionBrand

Source§

impl ApplySecond for ThunkBrand

Source§

impl ApplySecond for Tuple1Brand

Source§

impl ApplySecond for VecBrand

Source§

impl<A: 'static> ApplySecond for TryThunkOkAppliedBrand<A>

§Type Parameters
  • A: The success type.
Source§

impl<DoneType: Clone + 'static> ApplySecond for StepDoneAppliedBrand<DoneType>

§Type Parameters
  • DoneType: The done type.
Source§

impl<E: 'static> ApplySecond for TryThunkErrAppliedBrand<E>

§Type Parameters
  • E: The error type.
Source§

impl<E: Clone + 'static> ApplySecond for ResultErrAppliedBrand<E>

§Type Parameters
  • E: The error type.
Source§

impl<First: Clone + Semigroup + 'static> ApplySecond for PairFirstAppliedBrand<First>

§Type Parameters
  • First: The type of the first value in the pair.
Source§

impl<First: Clone + Semigroup + 'static> ApplySecond for Tuple2FirstAppliedBrand<First>

§Type Parameters
  • First: The type of the first value in the tuple.
Source§

impl<FunctionBrand: CloneableFn + 'static, A: 'static, B: 'static> ApplySecond for BazaarListBrand<FunctionBrand, A, B>

§Type Parameters
  • FunctionBrand: The cloneable function brand.
  • A: The focus type.
  • B: The replacement type.
Source§

impl<LoopType: Clone + 'static> ApplySecond for StepLoopAppliedBrand<LoopType>

§Type Parameters
  • LoopType: The loop type.
Source§

impl<R: 'static + Semigroup> ApplySecond for ConstBrand<R>

§Type Parameters
  • R: The stored type.
Source§

impl<Second: Clone + Semigroup + 'static> ApplySecond for PairSecondAppliedBrand<Second>

§Type Parameters
  • Second: The type of the second value in the pair.
Source§

impl<Second: Clone + Semigroup + 'static> ApplySecond for Tuple2SecondAppliedBrand<Second>

§Type Parameters
  • Second: The type of the second value in the tuple.
Source§

impl<T: Clone + 'static> ApplySecond for ResultOkAppliedBrand<T>

§Type Parameters
  • T: The success type.