Avoid an allocation in each function registration.

This commit is contained in:
Stephen Chung
2020-04-20 12:43:34 +08:00
parent a1e33af5a0
commit 976f3a7f6d
2 changed files with 15 additions and 14 deletions

View File

@@ -60,12 +60,6 @@ impl<F: Fn(&Dynamic) -> Box<dyn Iterator<Item = Dynamic>> + 'static> IteratorCal
/// Engine public API
impl Engine {
/// Register a custom function.
pub(crate) fn register_fn_raw(&mut self, fn_name: &str, args: Vec<TypeId>, f: Box<FnAny>) {
self.functions
.insert(calc_fn_spec(fn_name, args.into_iter()), f);
}
/// Register a custom type for use with the `Engine`.
/// The type must implement `Clone`.
///