Remove PackageLibrary and PackagesCollection.

This commit is contained in:
Stephen Chung
2020-12-22 22:36:30 +08:00
parent 2a7e6c0884
commit 0157f912e0
4 changed files with 16 additions and 76 deletions

View File

@@ -1,9 +1,8 @@
//! Configuration settings for [`Engine`].
use crate::packages::PackageLibrary;
use crate::stdlib::{format, string::String};
use crate::token::{is_valid_identifier, Token};
use crate::Engine;
use crate::{Engine, Module, Shared};
#[cfg(not(feature = "no_module"))]
use crate::stdlib::boxed::Box;
@@ -15,8 +14,8 @@ impl Engine {
/// When searching for functions, packages loaded later are preferred.
/// In other words, loaded packages are searched in reverse order.
#[inline(always)]
pub fn load_package(&mut self, package: impl Into<PackageLibrary>) -> &mut Self {
self.packages.add(package.into());
pub fn load_package(&mut self, package: impl Into<Shared<Module>>) -> &mut Self {
self.packages.insert(0, package.into());
self
}
/// Control whether and how the [`Engine`] will optimize an [`AST`][crate::AST] after compilation.