1) Change namespaces to iter_namespaces

2) throw can throw any value
This commit is contained in:
Stephen Chung
2020-10-20 18:09:26 +08:00
parent 09f8b13f2d
commit 5ee9dfc5cd
15 changed files with 97 additions and 69 deletions

View File

@@ -72,10 +72,10 @@ impl<'e, 'm, 'pm> NativeCallContext<'e, 'm, 'pm> {
pub fn engine(&self) -> &'e Engine {
self.engine
}
/// The chain of namespaces containing definition of all script-defined functions.
/// Get an iterator over the namespaces containing definition of all script-defined functions.
#[inline(always)]
pub fn namespaces(&self) -> &'m [&'pm Module] {
self.lib
pub fn iter_namespaces(&self) -> impl Iterator<Item = &'pm Module> + 'm {
self.lib.iter().cloned()
}
}
@@ -186,7 +186,7 @@ impl FnPtr {
.engine()
.exec_fn_call(
&mut Default::default(),
context.namespaces(),
context.lib,
fn_name,
hash_script,
args.as_mut(),