#[non_exhaustive]
pub enum CallableFunction {
    Pure(Shared<dyn Fn(NativeCallContext<'_>, &mut [&'_ mut Dynamic]) -> Result<Dynamic, Box<EvalAltResult>>>),
    Method(Shared<dyn Fn(NativeCallContext<'_>, &mut [&'_ mut Dynamic]) -> Result<Dynamic, Box<EvalAltResult>>>),
    Iterator(Shared<dyn Fn(Dynamic) -> Box<dyn Iterator<Item = Dynamic>>>),
    Plugin(Shared<dyn PluginFunction>),
    Script(Shared<ScriptFnDef>),
}
Expand description

A type encapsulating a function callable by Rhai.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Pure(Shared<dyn Fn(NativeCallContext<'_>, &mut [&'_ mut Dynamic]) -> Result<Dynamic, Box<EvalAltResult>>>)

A pure native Rust function with all arguments passed by value.

Method(Shared<dyn Fn(NativeCallContext<'_>, &mut [&'_ mut Dynamic]) -> Result<Dynamic, Box<EvalAltResult>>>)

A native Rust object method with the first argument passed by reference, and the rest passed by value.

Iterator(Shared<dyn Fn(Dynamic) -> Box<dyn Iterator<Item = Dynamic>>>)

An iterator function.

Plugin(Shared<dyn PluginFunction>)

A plugin function,

Script(Shared<ScriptFnDef>)

A script-defined function.

Implementations

Is this a pure native Rust function?

Is this a native Rust method function?

Is this an iterator function?

Is this a script-defined function?

Is this a plugin function?

Is this a native Rust function?

Get the access mode.

Get a shared reference to a native Rust function.

Get a shared reference to a script-defined function definition.

Not available under no_function.

Get a reference to an iterator function.

Get a shared reference to a plugin function.

Create a new CallableFunction::Pure.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.