Reduce Rc/Arc wrapping for functions.

This commit is contained in:
Stephen Chung
2020-05-19 22:25:57 +08:00
parent ab76a69b12
commit 4a1fd66b9f
6 changed files with 97 additions and 138 deletions

View File

@@ -1,6 +1,6 @@
//! Module containing all built-in _packages_ available to Rhai, plus facilities to define custom packages.
use crate::fn_native::CallableFunction;
use crate::fn_native::{CallableFunction, IteratorFn};
use crate::module::Module;
use crate::utils::StaticVec;
@@ -81,7 +81,7 @@ impl PackagesCollection {
self.packages.iter().any(|p| p.contains_iter(id))
}
/// Get the specified TypeId iterator.
pub fn get_iter(&self, id: TypeId) -> Option<&CallableFunction> {
pub fn get_iter(&self, id: TypeId) -> Option<&IteratorFn> {
self.packages
.iter()
.map(|p| p.get_iter(id))