define_function

Macro define_function 

Source
macro_rules! define_function {
    ($name:ident, args: [], $body:expr) => { ... };
    ($name:ident, args: [$arg_type:ty], $body:expr) => { ... };
    ($name:ident, args: [$arg_type1:ty, $arg_type2:ty], $body:expr) => { ... };
    ($name:ident, args: [$arg_type1:ty, $arg_type2:ty, $arg_type3:ty], $body:expr) => { ... };
    ($name:ident, args: [$arg_type1:ty, $arg_type2:ty, $arg_type3:ty, $arg_type4:ty], $body:expr) => { ... };
}
Expand description

Define a function that returns Result<T, E>. Expands to a FunctionHandler that:

  • Validates argument count (0–4).
  • Converts Value arguments to the specified Rust types.
  • Executes $body and maps Ok(T) into Value via Into<Value>.