pub struct DefaultModuleResolver { /* private fields */ }Expand description
The default resolver, combining standard library, local filesystem, and (optionally) HTTP sources.
Implementations§
Source§impl DefaultModuleResolver
impl DefaultModuleResolver
Sourcepub fn new(paths: Vec<PathBuf>) -> Self
pub fn new(paths: Vec<PathBuf>) -> Self
Creates a new resolver with the given filesystem search paths, backed by
NativeIo for local module resolution, i.e. full,
ungated disk access, matching this resolver’s historical behavior.
An empty paths slice falls back to the built-in default search directories.
Sourcepub fn with_io(io: Shared<dyn Io>, paths: Vec<PathBuf>) -> Self
pub fn with_io(io: Shared<dyn Io>, paths: Vec<PathBuf>) -> Self
Creates a new resolver whose local filesystem module resolution goes through io
instead of a bare NativeIo, e.g. a
SandboxedIo so include/import respect the same
read permission as the read_file/write_file/http builtins. HTTP module
imports are unaffected (still NativeIo-only, if the http-import-ureq feature
is enabled).
An empty paths slice falls back to the built-in default search directories.
Sourcepub fn module_names(&self) -> Vec<String>
pub fn module_names(&self) -> Vec<String>
Names of the standard modules and the .mq files in the local search directories,
sorted and without duplicates. Default search directories are used when none were given.
Trait Implementations§
Source§impl Clone for DefaultModuleResolver
impl Clone for DefaultModuleResolver
Source§impl Debug for DefaultModuleResolver
impl Debug for DefaultModuleResolver
Source§impl Default for DefaultModuleResolver
impl Default for DefaultModuleResolver
Source§impl ModuleResolver for DefaultModuleResolver
impl ModuleResolver for DefaultModuleResolver
Source§fn resolve(&self, module_name: &str) -> Result<String, ModuleError>
fn resolve(&self, module_name: &str) -> Result<String, ModuleError>
module_name.Source§fn get_path(&self, module_name: &str) -> Result<String, ModuleError>
fn get_path(&self, module_name: &str) -> Result<String, ModuleError>
module_name (for diagnostics / LSP).Source§fn search_paths(&self) -> Vec<PathBuf>
fn search_paths(&self) -> Vec<PathBuf>
Source§fn set_search_paths(&mut self, paths: Vec<PathBuf>)
fn set_search_paths(&mut self, paths: Vec<PathBuf>)
Source§fn canonical_name<'a>(&self, module_path: &'a str) -> &'a str
fn canonical_name<'a>(&self, module_path: &'a str) -> &'a str
Source§fn is_immutable_module(&self, module_path: &str) -> bool
fn is_immutable_module(&self, module_path: &str) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for DefaultModuleResolver
impl !Send for DefaultModuleResolver
impl !Sync for DefaultModuleResolver
impl !UnwindSafe for DefaultModuleResolver
impl Forget for DefaultModuleResolver
impl Freeze for DefaultModuleResolver
impl Move for DefaultModuleResolver
impl Unpin for DefaultModuleResolver
impl UnsafeUnpin for DefaultModuleResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more