Skip to main content

RefApplySecond

Trait RefApplySecond 

Source
pub trait RefApplySecond: RefLift + Kind_cdc7cd43dac7585f {
    // Provided method
    fn ref_apply_second<'a, A: 'a, B: Clone + 'a>(
        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 combining two by-ref contexts, keeping the second value.

Requires B: Clone because the closure receives &B and must produce an owned B. The default implementation uses RefLift::ref_lift2.

Provided Methods§

Source

fn ref_apply_second<'a, A: 'a, B: Clone + 'a>( 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.

§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. Must be Clone.
§Parameters
  • fa: The first context.
  • fb: The second context.
§Returns

A new context containing the value from the second context.

§Examples
use fp_library::{
	brands::*,
	classes::*,
	types::*,
};

let x = RcLazy::pure(3);
let y = RcLazy::pure(4);
let result = LazyBrand::<RcLazyConfig>::ref_apply_second(&x, &y);
assert_eq!(*result.evaluate(), 4);

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<Brand: RefLift> RefApplySecond for Brand

Blanket implementation of RefApplySecond.

§Type Parameters
  • Brand: The brand type.