Trait PluginFunc
pub trait PluginFunc {
// Required methods
fn call(
&self,
context: Option<NativeCallContext<'_>>,
args: &mut [&mut Dynamic],
) -> Result<Dynamic, Box<EvalAltResult>>;
fn is_method_call(&self) -> bool;
fn has_context(&self) -> bool;
// Provided methods
fn is_pure(&self) -> bool { ... }
fn is_volatile(&self) -> bool { ... }
}
Expand description
Trait implemented by a plugin function.
This trait should not be used directly.
Required Methods§
fn call(
&self,
context: Option<NativeCallContext<'_>>,
args: &mut [&mut Dynamic],
) -> Result<Dynamic, Box<EvalAltResult>>
fn call( &self, context: Option<NativeCallContext<'_>>, args: &mut [&mut Dynamic], ) -> Result<Dynamic, Box<EvalAltResult>>
Call the plugin function with the arguments provided.
fn is_method_call(&self) -> bool
fn is_method_call(&self) -> bool
Is this plugin function a method?
fn has_context(&self) -> bool
fn has_context(&self) -> bool
Does this plugin function contain a NativeCallContext
parameter?
Provided Methods§
fn is_pure(&self) -> bool
fn is_pure(&self) -> bool
Is this plugin function pure?
Defaults to true
such that any old implementation that has constant-checking code inside
the function itself will continue to work.
fn is_volatile(&self) -> bool
fn is_volatile(&self) -> bool
Is this plugin function volatile?
A volatile function is not guaranteed to return the same result for the same input(s).
Defaults to true
such that any old implementation that has constant-checking code inside
the function itself will continue to work.