Enum rhai::plugin::CallableFunction [−][src]
pub enum CallableFunction {
Pure(Rc<dyn Fn(&Engine, &Module, &mut [&'_ mut Dynamic]) -> Result<Dynamic, Box<EvalAltResult>>>),
Method(Rc<dyn Fn(&Engine, &Module, &mut [&'_ mut Dynamic]) -> Result<Dynamic, Box<EvalAltResult>>>),
Iterator(fn(_: Dynamic) -> Box<dyn Iterator<Item = Dynamic>>),
Plugin(Rc<dyn PluginFunction>),
Script(Rc<ScriptFnDef>),
}
Expand description
A type encapsulating a function callable by Rhai.
Variants
Pure(Rc<dyn Fn(&Engine, &Module, &mut [&'_ mut Dynamic]) -> Result<Dynamic, Box<EvalAltResult>>>)
Tuple Fields
A pure native Rust function with all arguments passed by value.
Method(Rc<dyn Fn(&Engine, &Module, &mut [&'_ mut Dynamic]) -> Result<Dynamic, Box<EvalAltResult>>>)
Tuple Fields
A native Rust object method with the first argument passed by reference, and the rest passed by value.
Iterator(fn(_: Dynamic) -> Box<dyn Iterator<Item = Dynamic>>)
An iterator function.
Plugin(Rc<dyn PluginFunction>)
Tuple Fields
0: Rc<dyn PluginFunction>
A plugin function,
Script(Rc<ScriptFnDef>)
Tuple Fields
0: Rc<ScriptFnDef>
A script-defined function.
Implementations
Is this a plugin function?
Get a reference to a native Rust function.
Panics
Panics if the CallableFunction
is not Pure
or Method
.
Get a shared reference to a script-defined function definition.
Panics
Panics if the CallableFunction
is not Script
.
Get a reference to a script-defined function definition.
Panics
Panics if the CallableFunction
is not Script
.
Create a new CallableFunction::Pure
.
Create a new CallableFunction::Method
.
Create a new CallableFunction::Plugin
.
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Auto Trait Implementations
impl !RefUnwindSafe for CallableFunction
impl !Send for CallableFunction
impl !Sync for CallableFunction
impl Unpin for CallableFunction
impl !UnwindSafe for CallableFunction
Blanket Implementations
Mutably borrows from an owned value. Read more