pub struct FileResolver<'a> { /* private fields */ }
Implementations§
Source§impl<'a> FileResolver<'a>
impl<'a> FileResolver<'a>
Sourcepub fn source_map(&self) -> &'a SourceMap
pub fn source_map(&self) -> &'a SourceMap
Returns the source map.
Sourcepub fn add_import_path(&mut self, path: PathBuf) -> bool
pub fn add_import_path(&mut self, path: PathBuf) -> bool
Adds an import path. Returns true
if the path is newly inserted.
Sourcepub fn add_import_map(&mut self, map: PathBuf, path: PathBuf)
pub fn add_import_map(&mut self, map: PathBuf, path: PathBuf)
Adds an import map.
Sourcepub fn get_import_path(
&self,
import_no: usize,
) -> Option<&(Option<PathBuf>, PathBuf)>
pub fn get_import_path( &self, import_no: usize, ) -> Option<&(Option<PathBuf>, PathBuf)>
Get the import path and the optional mapping corresponding to import_no
.
Sourcepub fn get_import_paths(&self) -> &[(Option<PathBuf>, PathBuf)]
pub fn get_import_paths(&self) -> &[(Option<PathBuf>, PathBuf)]
Get the import paths
Sourcepub fn get_import_map(&self, map: &Path) -> Option<&PathBuf>
pub fn get_import_map(&self, map: &Path) -> Option<&PathBuf>
Get the import path corresponding to a map
Sourcepub fn resolve_file(
&self,
path: &Path,
parent: Option<&Path>,
) -> Result<Arc<SourceFile>, ResolveError>
pub fn resolve_file( &self, path: &Path, parent: Option<&Path>, ) -> Result<Arc<SourceFile>, ResolveError>
Resolves an import path. parent
is the path of the file that contains the import, if any.
Sourcepub fn remap_path<'b>(&self, path: &'b Path) -> Cow<'b, Path>
pub fn remap_path<'b>(&self, path: &'b Path) -> Cow<'b, Path>
Applies the import path mappings to path
.
Sourcepub fn load_stdin(&self) -> Result<Arc<SourceFile>, ResolveError>
pub fn load_stdin(&self) -> Result<Arc<SourceFile>, ResolveError>
Loads stdin into the source map.
Sourcepub fn try_file(
&self,
path: &Path,
) -> Result<Option<Arc<SourceFile>>, ResolveError>
pub fn try_file( &self, path: &Path, ) -> Result<Option<Arc<SourceFile>>, ResolveError>
Loads path
into the source map. Returns None
if the file doesn’t exist.
Auto Trait Implementations§
impl<'a> Freeze for FileResolver<'a>
impl<'a> !RefUnwindSafe for FileResolver<'a>
impl<'a> Send for FileResolver<'a>
impl<'a> Sync for FileResolver<'a>
impl<'a> Unpin for FileResolver<'a>
impl<'a> !UnwindSafe for FileResolver<'a>
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
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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