Expand description
Thread-safe by-ref function application within contexts with send_ref_apply.
Like RefSemiapplicative::ref_apply,
but uses SendCloneFn<Ref> for thread-safe
function wrappers and requires element types to be Send + Sync.
§Examples
use fp_library::{
brands::*,
classes::*,
functions::*,
types::*,
};
let f = ArcLazy::new(|| {
std::sync::Arc::new(|x: &i32| *x * 2) as std::sync::Arc<dyn Fn(&i32) -> i32 + Send + Sync>
});
let x = ArcLazy::new(|| 5);
let result = send_ref_apply::<ArcFnBrand, LazyBrand<ArcLazyConfig>, _, _>(&f, &x);
assert_eq!(*result.evaluate(), 10);Traits§
- Send
RefSemiapplicative - A type class for applying wrapped thread-safe by-ref functions within contexts.
Functions§
- send_
ref_ apply - Applies a wrapped thread-safe by-ref function to a value within a context.