[][src]Macro glsp::rfn

macro_rules! rfn {
    ($fn_expr:expr) => { ... };
}

Wrap a function pointer or closure so that it can be passed to glsp::rfn and similar functions.

The macro receives a single argument, which must be the path to a function, the path to a method, or an expression which evaluates to a non-capturing closure.

The return value is a WrappedFn. This is an opaque type: it doesn't support any operations except being converted to an RFn.

In effect, this macro takes an arbitrary Rust function and converts it into a type-erased function pointer which can be called by GameLisp. The function's return value must implement IntoResult, and all of its arguments must implement MakeArg.