Skip to main content

SendRefApplySecond

Trait SendRefApplySecond 

Source
pub trait SendRefApplySecond: SendRefLift + Kind_cdc7cd43dac7585f {
    // Provided method
    fn send_ref_apply_second<'a, A: Send + Sync + 'a, B: Clone + Send + Sync + '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 thread-safe by-ref contexts, keeping the second value.

Requires B: Clone + Send + Sync because the closure receives &B and must produce an owned B. The default implementation uses SendRefLift::send_ref_lift2.

Provided Methods§

Source

fn send_ref_apply_second<'a, A: Send + Sync + 'a, B: Clone + Send + Sync + '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 + 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::*,
	classes::*,
	types::*,
};

let x = ArcLazy::new(|| 3);
let y = ArcLazy::new(|| 4);
let result = LazyBrand::<ArcLazyConfig>::send_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: SendRefLift> SendRefApplySecond for Brand

Blanket implementation of SendRefApplySecond.

§Type Parameters
  • Brand: The brand type.