define_implicit_function

Macro define_implicit_function 

Source
macro_rules! define_implicit_function {
    ($name:ident, args: [$arg_type0:path], $body:expr) => { ... };
    ($name:ident, args: [$arg_type0:path, $arg_type1:path], $body:expr) => { ... };
    ($name:ident, args: [$arg_type0:path, $arg_type1:path, $arg_type2:path], $body:expr) => { ... };
    ($name:ident, args: [$arg_type0:path, $arg_type1:path, $arg_type2:path, $arg_type3:path], $body:expr) => { ... };
}
Expand description

Define an implicit (method-style) function for specific Value types.

Expands to a FunctionHandler that:

  • Validates argument count (1–4).
  • For each argument, reuses the actual type if it matches $arg_typeN, otherwise converts via to_type.
  • Invokes $body with references to typed arguments and, for multi-arg variants, the evaluation context.