Change SharedPluginFunction to Shared<FnPlugin>

This commit is contained in:
Stephen Chung
2020-09-29 13:06:48 +08:00
parent 64c421b3d7
commit ea78fa2b27
8 changed files with 77 additions and 80 deletions

View File

@@ -17,11 +17,6 @@ use crate::stdlib::{
string::{String, ToString},
};
#[cfg(not(feature = "sync"))]
use crate::stdlib::rc::Rc;
#[cfg(feature = "sync")]
use crate::stdlib::sync::Arc;
/// A general expression evaluation trait object.
#[cfg(not(feature = "sync"))]
pub type FnCustomSyntaxEval = dyn Fn(
@@ -175,10 +170,7 @@ impl Engine {
let syntax = CustomSyntax {
segments,
#[cfg(not(feature = "sync"))]
func: Rc::new(func),
#[cfg(feature = "sync")]
func: Arc::new(func),
func: (Box::new(func) as Box<FnCustomSyntaxEval>).into(),
scope_delta,
};