pub trait RefApplyFirst: RefLift + Kind_cdc7cd43dac7585f {
// Provided method
fn ref_apply_first<'a, A: Clone + 'a, B: 'a>(
fa: &<Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
fb: &<Self as Kind_cdc7cd43dac7585f>::Of<'a, B>,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, A> { ... }
}Expand description
A type class for combining two by-ref contexts, keeping the first value.
Requires A: Clone because the closure receives &A and must produce
an owned A. The default implementation uses RefLift::ref_lift2.
Provided Methods§
Sourcefn ref_apply_first<'a, A: Clone + 'a, B: 'a>(
fa: &<Self as Kind_cdc7cd43dac7585f>::Of<'a, A>,
fb: &<Self as Kind_cdc7cd43dac7585f>::Of<'a, B>,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>
fn ref_apply_first<'a, A: Clone + 'a, B: 'a>( fa: &<Self as Kind_cdc7cd43dac7585f>::Of<'a, A>, fb: &<Self as Kind_cdc7cd43dac7585f>::Of<'a, B>, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>
Combines two contexts, keeping the value from the first.
§Type Signature
forall A B. (&Self A, &Self B) -> Self A
§Type Parameters
'a: The lifetime of the values.A: The type of the value in the first context. Must beClone.B: The type of the value in the second context.
§Parameters
fa: The first context.fb: The second context.
§Returns
A new context containing the value from the first context.
§Examples
use fp_library::{
brands::*,
classes::*,
types::*,
};
let x = RcLazy::pure(3);
let y = RcLazy::pure(4);
let result = LazyBrand::<RcLazyConfig>::ref_apply_first(&x, &y);
assert_eq!(*result.evaluate(), 3);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§
impl<Brand: RefLift> RefApplyFirst for Brand
Blanket implementation of RefApplyFirst.
§Type Parameters
Brand: The brand type.