pub trait PluginFunction {
    // Required methods
    fn call(
        &self,
        context: Option<NativeCallContext<'_>>,
        args: &mut [&'_ mut Dynamic]
    ) -> RhaiResult;
    fn is_method_call(&self) -> bool;
    fn has_context(&self) -> bool;

    // Provided method
    fn is_pure(&self) -> bool { ... }
}
Expand description

Trait implemented by a plugin function.

This trait should not be used directly. Use the #[export_module] and #[export_fn] procedural attributes instead.

Required Methods§

source

fn call( &self, context: Option<NativeCallContext<'_>>, args: &mut [&'_ mut Dynamic] ) -> RhaiResult

Call the plugin function with the arguments provided.

source

fn is_method_call(&self) -> bool

Is this plugin function a method?

source

fn has_context(&self) -> bool

Does this plugin function contain a NativeCallContext parameter?

Provided Methods§

source

fn is_pure(&self) -> bool

Is this plugin function pure?

This defaults to true such that any old implementation that has constant-checking code inside the function itself will continue to work.

Implementors§