Module std::fun
The closure traits, one per arity. A closure passed where a bound F: Fn(A) -> R is
expected implements Fn1<A, R>; its body runs with no capabilities.
Source: std/fun.weir; committed interface: std/fun.iface. Index
- trait
Fn0: A closure taking no arguments and returningR. - trait
Fn1: A closure taking one argument and returningR; the boundFn(A) -> Rnames it. - trait
Fn2: A closure taking two arguments and returningR. - trait
Fn3: A closure taking three arguments and returningR.
trait Fn0
pub trait Fn0<R> {
fn call(&mut self) -> R;
}
A closure taking no arguments and returning R.
method call
fn call(&mut self) -> R;
Runs the closure; it may update its own captures.
trait Fn1
pub trait Fn1<A, R> {
fn call(&mut self, a: A) -> R;
}
A closure taking one argument and returning R; the bound Fn(A) -> R names it.
method call
fn call(&mut self, a: A) -> R;
Runs the closure on a; it may update its own captures.
trait Fn2
pub trait Fn2<A, B, R> {
fn call(&mut self, a: A, b: B) -> R;
}
A closure taking two arguments and returning R.
method call
fn call(&mut self, a: A, b: B) -> R;
Runs the closure on a and b; it may update its own captures.
trait Fn3
pub trait Fn3<A, B, C, R> {
fn call(&mut self, a: A, b: B, c: C) -> R;
}
A closure taking three arguments and returning R.
method call
fn call(&mut self, a: A, b: B, c: C) -> R;
Runs the closure on a, b and c; it may update its own captures.