Engine::load_package API change.
This commit is contained in:
parent
a2858e0fd3
commit
096eb4493e
@ -33,6 +33,7 @@ Breaking changes
|
|||||||
* Function signature for defining custom syntax is simplified.
|
* Function signature for defining custom syntax is simplified.
|
||||||
* `Engine::register_raw_fn_XXX` API shortcuts are removed.
|
* `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.
|
* `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<PackageLibrary>`.
|
||||||
|
|
||||||
Housekeeping
|
Housekeeping
|
||||||
------------
|
------------
|
||||||
|
@ -18,9 +18,9 @@ impl Engine {
|
|||||||
///
|
///
|
||||||
/// When searching for functions, packages loaded later are preferred.
|
/// When searching for functions, packages loaded later are preferred.
|
||||||
/// In other words, loaded packages are searched in reverse order.
|
/// 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<PackageLibrary>) -> &mut Self {
|
||||||
// Push the package to the top - packages are searched in reverse order
|
// Push the package to the top - packages are searched in reverse order
|
||||||
self.packages.push(package);
|
self.packages.push(package.into());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ fn test_fn_ptr_curry_call() -> Result<(), Box<EvalAltResult>> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let mut engine = Engine::new();
|
let mut engine = Engine::new();
|
||||||
engine.load_package(module.into());
|
engine.load_package(module);
|
||||||
|
|
||||||
#[cfg(not(feature = "no_object"))]
|
#[cfg(not(feature = "no_object"))]
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
Loading…
Reference in New Issue
Block a user