Change HashMap to BTreeMap.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::stdlib::{
|
||||
boxed::Box,
|
||||
collections::HashMap,
|
||||
collections::BTreeMap,
|
||||
io::Error as IoError,
|
||||
path::{Path, PathBuf},
|
||||
string::String,
|
||||
@@ -44,9 +44,9 @@ pub struct FileModuleResolver {
|
||||
cache_enabled: bool,
|
||||
|
||||
#[cfg(not(feature = "sync"))]
|
||||
cache: crate::stdlib::cell::RefCell<HashMap<PathBuf, Shared<Module>>>,
|
||||
cache: crate::stdlib::cell::RefCell<BTreeMap<PathBuf, Shared<Module>>>,
|
||||
#[cfg(feature = "sync")]
|
||||
cache: crate::stdlib::sync::RwLock<HashMap<PathBuf, Shared<Module>>>,
|
||||
cache: crate::stdlib::sync::RwLock<BTreeMap<PathBuf, Shared<Module>>>,
|
||||
}
|
||||
|
||||
impl Default for FileModuleResolver {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use crate::stdlib::{boxed::Box, collections::HashMap, ops::AddAssign, string::String};
|
||||
use crate::stdlib::{boxed::Box, collections::BTreeMap, ops::AddAssign, string::String};
|
||||
use crate::{Engine, EvalAltResult, Module, ModuleResolver, Position, Shared};
|
||||
|
||||
/// A static [module][Module] resolution service that serves [modules][Module] added into it.
|
||||
@@ -19,7 +19,7 @@ use crate::{Engine, EvalAltResult, Module, ModuleResolver, Position, Shared};
|
||||
/// engine.set_module_resolver(resolver);
|
||||
/// ```
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct StaticModuleResolver(HashMap<String, Shared<Module>>);
|
||||
pub struct StaticModuleResolver(BTreeMap<String, Shared<Module>>);
|
||||
|
||||
impl StaticModuleResolver {
|
||||
/// Create a new [`StaticModuleResolver`].
|
||||
|
Reference in New Issue
Block a user