pub trait RegisterNativeFunction<A: 'static, const N: usize, const X: bool, R: 'static, const F: bool> {
    fn into_callable_function(
        self,
        name: Identifier,
        no_const: bool
    ) -> CallableFunction; fn param_types() -> [TypeId; N]; fn param_names() -> [&'static str; N]; fn num_params() -> usize { ... } fn has_context() -> bool { ... } fn return_type() -> TypeId { ... } fn return_type_name() -> &'static str { ... } }
Expand description

Trait to register custom Rust functions.

Type Parameters

  • A - a tuple containing parameter types, with &mut T represented by Mut<T>.
  • N - a constant generic containing the number of parameters, must be consistent with ARGS.
  • X - a constant boolean generic indicating whether there is a NativeCallContext parameter.
  • R - return type of the function; if the function returns Result, it is the unwrapped inner value type.
  • F - a constant boolean generic indicating whether the function is fallible (i.e. returns Result<T, Box<EvalAltResult>>).

Required Methods§

Convert this function into a CallableFunction.

Get the type ID’s of this function’s parameters.

(metadata) Get the type names of this function’s parameters. Exported under the metadata feature only.

Provided Methods§

Get the number of parameters for this function.

Is there a NativeCallContext parameter for this function?

(metadata) Get the type ID of this function’s return value. Exported under the metadata feature only.

(metadata) Get the type name of this function’s return value. Exported under the metadata feature only.

Implementors§