From 096eb4493e058988cc503d4e4fcbd2b769ac688f Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sun, 2 Aug 2020 18:55:22 +0800 Subject: [PATCH] Engine::load_package API change. --- RELEASES.md | 1 + src/settings.rs | 4 ++-- tests/closures.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index f163f06f..d727a20e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -33,6 +33,7 @@ Breaking changes * Function signature for defining custom syntax is simplified. * `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. +* `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/closures.rs b/tests/closures.rs index 3aec4865..27ecc5e6 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!(