Clean up types.

This commit is contained in:
Stephen Chung
2022-11-08 15:01:40 +08:00
parent f4e2901353
commit 6053aa1641
28 changed files with 248 additions and 248 deletions

View File

@@ -4,7 +4,8 @@
use crate::eval::GlobalRuntimeState;
use crate::func::{locked_read, locked_write};
use crate::{
Engine, Identifier, Locked, Module, ModuleResolver, Position, RhaiResultOf, Scope, Shared, ERR,
Engine, Identifier, Locked, Module, ModuleResolver, Position, RhaiResultOf, Scope, Shared,
SharedModule, ERR,
};
use std::{
@@ -51,7 +52,7 @@ pub struct FileModuleResolver {
extension: Identifier,
cache_enabled: bool,
scope: Scope<'static>,
cache: Locked<BTreeMap<PathBuf, Shared<Module>>>,
cache: Locked<BTreeMap<PathBuf, SharedModule>>,
}
impl Default for FileModuleResolver {
@@ -258,7 +259,7 @@ impl FileModuleResolver {
/// The next time this path is resolved, the script file will be loaded once again.
#[inline]
#[must_use]
pub fn clear_cache_for_path(&mut self, path: impl AsRef<Path>) -> Option<Shared<Module>> {
pub fn clear_cache_for_path(&mut self, path: impl AsRef<Path>) -> Option<SharedModule> {
locked_write(&self.cache)
.remove_entry(path.as_ref())
.map(|(.., v)| v)
@@ -293,7 +294,7 @@ impl FileModuleResolver {
source: Option<&str>,
path: &str,
pos: Position,
) -> Result<Shared<Module>, Box<crate::EvalAltResult>> {
) -> Result<SharedModule, Box<crate::EvalAltResult>> {
// Load relative paths from source if there is no base path specified
let source_path = global
.as_ref()
@@ -344,7 +345,7 @@ impl ModuleResolver for FileModuleResolver {
global: &mut GlobalRuntimeState,
path: &str,
pos: Position,
) -> RhaiResultOf<Shared<Module>> {
) -> RhaiResultOf<SharedModule> {
self.impl_resolve(engine, Some(global), None, path, pos)
}
@@ -355,7 +356,7 @@ impl ModuleResolver for FileModuleResolver {
source: Option<&str>,
path: &str,
pos: Position,
) -> RhaiResultOf<Shared<Module>> {
) -> RhaiResultOf<SharedModule> {
self.impl_resolve(engine, None, source, path, pos)
}