Skip to main content

send_ref_apply_second

Function send_ref_apply_second 

Source
pub fn send_ref_apply_second<'a, Brand: SendRefApplySecond, A: Send + Sync + 'a, B: Clone + Send + Sync + 'a>(
    fa: &<Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>,
    fb: &<Brand as Kind_cdc7cd43dac7585f>::Of<'a, B>,
) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, B>
Expand description

Combines two thread-safe contexts, keeping the value from the second.

Free function version that dispatches to the type class’ associated function.

§Type Signature

forall Brand A B. SendRefApplySecond Brand => (&Brand A, &Brand B) -> Brand B

§Type Parameters

  • 'a: The lifetime of the values.
  • Brand: The brand of the context.
  • A: The type of the value in the first context.
  • B: The type of the value in the second context. Must be Clone + Send + Sync.

§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::*,
	functions::*,
	types::*,
};

let x = ArcLazy::new(|| 3);
let y = ArcLazy::new(|| 4);
let result = send_ref_apply_second::<LazyBrand<ArcLazyConfig>, _, _>(&x, &y);
assert_eq!(*result.evaluate(), 4);