Skip to main content

Module send_clone_fn

Module send_clone_fn 

Source
Expand description

Thread-safe cloneable wrappers over closures that carry Send + Sync bounds.

§Examples

use {
	fp_library::{
		brands::*,
		functions::*,
	},
	std::thread,
};

let f = send_lift_fn_new::<ArcFnBrand, _, _>(|x: i32| x * 2);

// Can be sent to another thread
let handle = thread::spawn(move || {
	assert_eq!(f(5), 10);
});
handle.join().unwrap();

Traits§

SendCloneFn
Abstraction for thread-safe cloneable wrappers over closures.
SendLiftFn
A trait for constructing thread-safe cloneable function wrappers from closures.
SendRefLiftFn
A trait for constructing thread-safe Ref-mode cloneable function wrappers.

Functions§

new
Creates a new thread-safe cloneable function wrapper.
ref_new
Creates a new thread-safe cloneable by-reference function wrapper.