Crate pfn

Crate pfn 

Source
Expand description

§PFn

Provide fn_trait’s call, call_mut, and call_once on Stable Rust for functions / closures with ≤ 12 arguments.

§Example Usage

use pfn::PFn;
let closure = |x: i32, y: i32, z: &str| {
	println!("{}", z);
	x + y
};
 
// Once the `fn_trait` feature has stabilized, you would do this.
// let result = closure.call((5, 42, "Hello World"));
 
// For now, use PFn.
let result = closure.pfn_call((5, 42, "Hello World"));

Traits§

PFn
A trait implementing call as pfn_call.
PFnMut
A trait implementing call_mut as pfn_call_mut.
PFnOnce
A trait implementing call_once as pfn_call_once.