ApplySecond

Trait ApplySecond 

Source
pub trait ApplySecond: Kind0L1T {
    // Required method
    fn apply_second<'a, ClonableFnBrand: 'a + ClonableFn, A: 'a + Clone, B: 'a + Clone>(
        fa: Apply0L1T<Self, A>,
    ) -> ApplyFn<'a, ClonableFnBrand, Apply0L1T<Self, B>, Apply0L1T<Self, 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. This is useful for executing side effects in sequence while preserving the final result.

Required Methods§

Source

fn apply_second<'a, ClonableFnBrand: 'a + ClonableFn, A: 'a + Clone, B: 'a + Clone>( fa: Apply0L1T<Self, A>, ) -> ApplyFn<'a, ClonableFnBrand, Apply0L1T<Self, B>, Apply0L1T<Self, 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 containing a value (will be discarded).
  • fb: The second context containing a value.
§Returns

The second context with its value preserved.

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 IdentityBrand

Source§

impl ApplySecond for OptionBrand

Source§

impl ApplySecond for VecBrand

Source§

impl<E> ApplySecond for ResultWithErrBrand<E>
where for<'a> E: 'a + Clone,

Source§

impl<First> ApplySecond for PairWithFirstBrand<First>
where for<'a> Apply1L0T<'a, First>: Semigroup<'a>, for<'a> First: Semigroup1L0T<Output<'a> = First> + Clone,

Source§

impl<Second> ApplySecond for PairWithSecondBrand<Second>
where for<'a> Apply1L0T<'a, Second>: Semigroup<'a>, for<'a> Second: Semigroup1L0T<Output<'a> = Second> + Clone,

Source§

impl<T> ApplySecond for ResultWithOkBrand<T>
where for<'a> T: 'a + Clone,