Fix tests.

This commit is contained in:
Stephen Chung 2020-10-17 14:08:59 +08:00
parent 39474d6420
commit 8eb6c821d4
2 changed files with 0 additions and 31 deletions

View File

@ -425,30 +425,6 @@ impl Module {
} }
} }
/// Does the particular Rust function exist in the module?
///
/// The `u64` hash is calculated by the function `crate::calc_fn_hash`.
/// It is also returned by the `set_fn_XXX` calls.
///
/// # Examples
///
/// ```
/// use rhai::Module;
///
/// let mut module = Module::new();
/// module.set_fn_0("calc", || Ok(42_i64));
/// assert!(module.contains_fn_with_name("calc", true));
/// ```
#[inline]
#[allow(dead_code)]
pub(crate) fn contains_fn_with_name(&self, fn_name: &str, public_only: bool) -> bool {
self.functions
.values()
.filter(|(_, access, _, _, _)| !public_only || access.is_public())
.find(|(name, _, _, _, _)| name == fn_name)
.is_some()
}
/// Set a Rust function into the module, returning a hash key. /// Set a Rust function into the module, returning a hash key.
/// ///
/// If there is an existing Rust function of the same hash, it is replaced. /// If there is an existing Rust function of the same hash, it is replaced.

View File

@ -65,13 +65,6 @@ impl PackagesCollection {
pub fn contains_fn(&self, hash: u64, public_only: bool) -> bool { pub fn contains_fn(&self, hash: u64, public_only: bool) -> bool {
self.0.iter().any(|p| p.contains_fn(hash, public_only)) self.0.iter().any(|p| p.contains_fn(hash, public_only))
} }
/// Does the specified function name exist in the `PackagesCollection`?
#[allow(dead_code)]
pub fn contains_fn_with_name(&self, fn_name: &str, public_only: bool) -> bool {
self.0
.iter()
.any(|p| p.contains_fn_with_name(fn_name, public_only))
}
/// Get specified function via its hash key. /// Get specified function via its hash key.
pub fn get_fn(&self, hash: u64, public_only: bool) -> Option<&CallableFunction> { pub fn get_fn(&self, hash: u64, public_only: bool) -> Option<&CallableFunction> {
self.0 self.0