diff --git a/src/packages/iter_basic.rs b/src/packages/iter_basic.rs index 9672d61c..031ac095 100644 --- a/src/packages/iter_basic.rs +++ b/src/packages/iter_basic.rs @@ -1,8 +1,7 @@ -use super::{reg_binary, reg_trinary, reg_unary_mut, PackageStore}; +use super::{reg_binary, reg_trinary, PackageStore}; -use crate::any::{Dynamic, Union, Variant}; +use crate::any::{Dynamic, Variant}; use crate::def_package; -use crate::engine::{Array, Map}; use crate::fn_register::map_dynamic as map; use crate::parser::INT; diff --git a/src/packages/utils.rs b/src/packages/utils.rs index 122bb63a..fd631b22 100644 --- a/src/packages/utils.rs +++ b/src/packages/utils.rs @@ -239,44 +239,6 @@ pub fn reg_unary_mut( lib.functions.insert(hash, f); } -#[cfg(not(feature = "sync"))] -pub(crate) fn reg_test<'a, A: Variant + Clone, B: Variant + Clone, X, R>( - lib: &mut PackageStore, - fn_name: &'static str, - - #[cfg(not(feature = "sync"))] func: impl Fn(X, B) -> R + 'static, - #[cfg(feature = "sync")] func: impl Fn(X, B) -> R + Send + Sync + 'static, - - map: impl Fn(&mut A) -> X + 'static, - - #[cfg(not(feature = "sync"))] map_result: impl Fn(R, Position) -> Result> - + 'static, - #[cfg(feature = "sync")] map_result: impl Fn(R, Position) -> Result> - + Send - + Sync - + 'static, -) { - //println!("register {}({}, {})", fn_name, crate::std::any::type_name::(), crate::std::any::type_name::()); - - let hash = calc_fn_hash( - fn_name, - [TypeId::of::(), TypeId::of::()].iter().cloned(), - ); - - let f = Box::new(move |args: &mut FnCallArgs, pos: Position| { - check_num_args(fn_name, 2, args, pos)?; - - let mut drain = args.iter_mut(); - let x: X = map(drain.next().unwrap().downcast_mut::().unwrap()); - let y: B = drain.next().unwrap().downcast_mut::().unwrap().clone(); - - let r = func(x, y); - map_result(r, pos) - }); - - lib.functions.insert(hash, f); -} - /// Add a function with two parameters to the package. /// /// `map_result` is a function that maps the return type of the function to `Result`.