diff --git a/RELEASES.md b/RELEASES.md index 1679aa0c..79f298ec 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -35,6 +35,7 @@ Breaking changes * `Engine::register_raw_fn_XXX` API shortcuts are removed. * `PackagesCollection::get_fn`, `PackagesCollection::contains_fn`, `Module::get_fn` and `Module::contains_fn` now take an additional `public_only` parameter indicating whether only public functions are accepted. * The iterator returned by `Scope::iter` now contains a clone of the `Dynamic` value (unshared). +* `Engine::load_package` takes any type that is `Into`. Housekeeping ------------ diff --git a/src/settings.rs b/src/settings.rs index d638499c..d4949a41 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -18,9 +18,9 @@ impl Engine { /// /// When searching for functions, packages loaded later are preferred. /// In other words, loaded packages are searched in reverse order. - pub fn load_package(&mut self, package: PackageLibrary) -> &mut Self { + pub fn load_package(&mut self, package: impl Into) -> &mut Self { // Push the package to the top - packages are searched in reverse order - self.packages.push(package); + self.packages.push(package.into()); self } diff --git a/tests/call_fn.rs b/tests/call_fn.rs index 0f9087d2..a22f7b6d 100644 --- a/tests/call_fn.rs +++ b/tests/call_fn.rs @@ -88,6 +88,7 @@ fn test_call_fn_private() -> Result<(), Box> { fn test_fn_ptr_raw() -> Result<(), Box> { let mut engine = Engine::new(); + #[allow(deprecated)] engine .register_fn("mul", |x: &mut INT, y: INT| *x *= y) .register_raw_fn( diff --git a/tests/closures.rs b/tests/closures.rs index f0a91ac6..0736654b 100644 --- a/tests/closures.rs +++ b/tests/closures.rs @@ -16,7 +16,7 @@ fn test_fn_ptr_curry_call() -> Result<(), Box> { ); let mut engine = Engine::new(); - engine.load_package(module.into()); + engine.load_package(module); #[cfg(not(feature = "no_object"))] assert_eq!(