Merge branch 'master' into plugins

This commit is contained in:
Stephen Chung
2020-07-26 14:07:29 +08:00
24 changed files with 464 additions and 225 deletions

View File

@@ -2,15 +2,19 @@
use crate::any::Dynamic;
use crate::engine::Engine;
use crate::module::{FuncReturn, Module};
use crate::parser::ScriptFnDef;
use crate::module::Module;
use crate::plugin::PluginFunction;
use crate::result::EvalAltResult;
use crate::token::{is_valid_identifier, Position};
use crate::utils::{ImmutableString, StaticVec};
use crate::Scope;
use crate::utils::ImmutableString;
use crate::stdlib::{boxed::Box, convert::TryFrom, fmt, mem, string::String, vec::Vec};
#[cfg(not(feature = "no_function"))]
use crate::{module::FuncReturn, parser::ScriptFnDef, scope::Scope, utils::StaticVec};
use crate::stdlib::{boxed::Box, convert::TryFrom, fmt, string::String, vec::Vec};
#[cfg(not(feature = "no_function"))]
use crate::stdlib::mem;
#[cfg(not(feature = "sync"))]
use crate::stdlib::rc::Rc;
@@ -86,12 +90,17 @@ impl FnPtr {
/// Call the function pointer with curried arguments (if any).
///
/// The function must be a script-defined function. It cannot be a Rust function.
///
/// To call a Rust function, just call it directly in Rust!
///
/// ## WARNING
///
/// All the arguments are _consumed_, meaning that they're replaced by `()`.
/// This is to avoid unnecessarily cloning the arguments.
/// Do not use the arguments after this call. If they are needed afterwards,
/// clone them _before_ calling this function.
#[cfg(not(feature = "no_function"))]
pub fn call_dynamic(
&self,
engine: &Engine,