Use type alias

This commit is contained in:
Stephen Chung
2021-12-25 23:49:14 +08:00
parent 43363e0660
commit 01c35808cb
42 changed files with 538 additions and 702 deletions

View File

@@ -2,7 +2,10 @@
#![cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
use crate::func::native::shared_write_lock;
use crate::{Engine, EvalAltResult, Identifier, Module, ModuleResolver, Position, Scope, Shared};
use crate::{
Engine, EvalAltResult, Identifier, Module, ModuleResolver, Position, RhaiResultOf, Scope,
Shared,
};
use std::{
collections::BTreeMap,
@@ -259,7 +262,7 @@ impl ModuleResolver for FileModuleResolver {
source_path: Option<&str>,
path: &str,
pos: Position,
) -> Result<Shared<Module>, Box<EvalAltResult>> {
) -> RhaiResultOf<Shared<Module>> {
// Load relative paths from source if there is no base path specified
let source_path =
source_path.and_then(|p| Path::new(p).parent().map(|p| p.to_string_lossy()));
@@ -315,7 +318,7 @@ impl ModuleResolver for FileModuleResolver {
source_path: Option<&str>,
path: &str,
pos: Position,
) -> Option<Result<crate::AST, Box<EvalAltResult>>> {
) -> Option<RhaiResultOf<crate::AST>> {
// Construct the script file path
let file_path = self.get_file_path(path, source_path);