pub struct FileResolver { /* private fields */ }Expand description
A resolver that looks for files in the filesystem.
It simply translates module paths to file paths. This is the intended behavior.
Implementations§
Source§impl FileResolver
impl FileResolver
Sourcepub fn new(pkg_root_dir: impl AsRef<Path>) -> Self
pub fn new(pkg_root_dir: impl AsRef<Path>) -> Self
Create a new resolver.
pkg_root_dir is the package root directory which package:: paths refer to.
Sourcepub fn set_root(&mut self, pkg_root_dir: impl AsRef<Path>)
pub fn set_root(&mut self, pkg_root_dir: impl AsRef<Path>)
Set the the package root directory which package:: paths refer to.
Sourcepub fn set_extension(&mut self, extension: &'static str)
pub fn set_extension(&mut self, extension: &'static str)
Look for files that ends with a different extension. Default: “wesl”.
Trait Implementations§
Source§impl Default for FileResolver
impl Default for FileResolver
Source§impl Resolver for FileResolver
impl Resolver for FileResolver
Source§fn resolve_source<'a>(
&'a self,
path: &ModulePath,
) -> Result<Cow<'a, str>, ResolveError>
fn resolve_source<'a>( &'a self, path: &ModulePath, ) -> Result<Cow<'a, str>, ResolveError>
Try to resolve a source file identified by a module path.
Source§fn display_name(&self, path: &ModulePath) -> Option<String>
fn display_name(&self, path: &ModulePath) -> Option<String>
Get the display name of the module path. Implementing this is optional.
Source§fn fs_path(&self, path: &ModulePath) -> Result<PathBuf, ResolveError>
fn fs_path(&self, path: &ModulePath) -> Result<PathBuf, ResolveError>
Get the filesystem path of the module path. Implementing this is optional.
Source§fn module_path(&self, fs_path: &Path) -> Result<ModulePath, ResolveError>
fn module_path(&self, fs_path: &Path) -> Result<ModulePath, ResolveError>
Get the module path of the filesystem path. Implementing this is optional.
Source§fn canonical_path(&self, path: &ModulePath) -> ModulePath
fn canonical_path(&self, path: &ModulePath) -> ModulePath
Get the canonical form of a module path.
Auto Trait Implementations§
impl Freeze for FileResolver
impl RefUnwindSafe for FileResolver
impl Send for FileResolver
impl Sync for FileResolver
impl Unpin for FileResolver
impl UnsafeUnpin for FileResolver
impl UnwindSafe for FileResolver
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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