Revise on_def_var API.

This commit is contained in:
Stephen Chung
2022-02-15 10:56:05 +08:00
parent 5bb6ce835f
commit fb9964e1a3
6 changed files with 59 additions and 29 deletions

View File

@@ -1,6 +1,7 @@
//! Module defining interfaces to native-Rust functions.
use super::call::FnCallArgs;
use crate::api::events::VarDefInfo;
use crate::ast::FnCallHashes;
use crate::eval::{EvalState, GlobalRuntimeState};
use crate::plugin::PluginFunction;
@@ -447,9 +448,8 @@ pub type OnVarCallback =
/// Callback function for variable definition.
#[cfg(not(feature = "sync"))]
pub type OnDefVarCallback =
dyn Fn(&str, bool, bool, usize, bool, &EvalContext) -> RhaiResultOf<bool>;
pub type OnDefVarCallback = dyn Fn(bool, VarDefInfo, &EvalContext) -> RhaiResultOf<bool>;
/// Callback function for variable definition.
#[cfg(feature = "sync")]
pub type OnDefVarCallback =
dyn Fn(&str, bool, bool, usize, bool, &EvalContext) -> RhaiResultOf<bool> + Send + Sync;
dyn Fn(bool, VarDefInfo, &EvalContext) -> RhaiResultOf<bool> + Send + Sync;