xprs_fn

Macro xprs_fn 

Source
macro_rules! xprs_fn {
    ($name:expr, $function:expr) => { ... };
    ($name:expr, dyn $function:expr) => { ... };
    ($function:expr) => { ... };
    (dyn $function:expr) => { ... };
    ($name:expr, $function:expr, $nb_args:tt) => { ... };
    ($name:expr, dyn $function:expr, $nb_args:tt) => { ... };
    ($function:expr, $nb_args:tt) => { ... };
    (dyn $function:expr, $nb_args:tt) => { ... };
    (wrap $function:expr, 0) => { ... };
    (wrap $function:expr, 1) => { ... };
    (wrap $function:expr, 2) => { ... };
    (wrap $function:expr, 3) => { ... };
    (wrap $function:expr, 4) => { ... };
    (wrap $function:expr, 5) => { ... };
    (wrap $function:expr, 6) => { ... };
    (wrap $function:expr, 7) => { ... };
    (wrap $function:expr, 8) => { ... };
    (wrap $function:expr, 9) => { ... };
}
Expand description

Macro for defining functions for xprs’ context easily, with optional variadic support. This macro is provided for convenience, since crate::Function needs a fn taking a slice of f64 as argument. The macro will wrap your function in a closure depending on the number of arguments you provide. Be aware that the provided function gets moved into the closure, so if you want to use it again, you’ll have to clone it.

Don’t provide the number of arguments if your function is variadic (takes any number of arguments).