Introduce RhaiResult.

This commit is contained in:
Stephen Chung
2021-03-02 15:02:28 +08:00
parent 521c8fad27
commit e3e53bd399
13 changed files with 54 additions and 79 deletions

View File

@@ -4,7 +4,7 @@ pub use crate::fn_native::{CallableFunction, FnCallArgs};
pub use crate::stdlib::{any::TypeId, boxed::Box, format, mem, string::ToString, vec as new_vec};
pub use crate::{
Dynamic, Engine, EvalAltResult, FnAccess, FnNamespace, ImmutableString, Module,
NativeCallContext, Position, RegisterFn, RegisterResultFn,
NativeCallContext, Position, RegisterFn, RegisterResultFn, RhaiResult,
};
#[cfg(not(features = "no_module"))]
@@ -18,11 +18,7 @@ pub use rhai_codegen::{export_fn, register_exported_fn};
/// Use the `#[export_module]` and `#[export_fn]` procedural attributes instead.
pub trait PluginFunction {
/// Call the plugin function with the arguments provided.
fn call(
&self,
context: NativeCallContext,
args: &mut FnCallArgs,
) -> Result<Dynamic, Box<EvalAltResult>>;
fn call(&self, context: NativeCallContext, args: &mut FnCallArgs) -> RhaiResult;
/// Is this plugin function a method?
fn is_method_call(&self) -> bool;