pub struct FileResolver<'a> { /* private fields */ }
Expand description
Performs file resolution by applying import paths and mappings.
Implementations§
Source§impl<'a> FileResolver<'a>
impl<'a> FileResolver<'a>
Sourcepub fn configure_from_sess(&mut self, sess: &Session)
pub fn configure_from_sess(&mut self, sess: &Session)
Configures the file resolver from a session.
Sourcepub fn set_current_dir(&mut self, current_dir: &Path)
pub fn set_current_dir(&mut self, current_dir: &Path)
Sourcepub fn add_include_paths(&mut self, paths: impl IntoIterator<Item = PathBuf>)
pub fn add_include_paths(&mut self, paths: impl IntoIterator<Item = PathBuf>)
Adds include paths.
Sourcepub fn add_include_path(&mut self, path: PathBuf)
pub fn add_include_path(&mut self, path: PathBuf)
Adds an include path.
Sourcepub fn add_import_remappings(
&mut self,
remappings: impl IntoIterator<Item = ImportRemapping>,
)
pub fn add_import_remappings( &mut self, remappings: impl IntoIterator<Item = ImportRemapping>, )
Adds import remappings.
Sourcepub fn add_import_remapping(&mut self, remapping: ImportRemapping)
pub fn add_import_remapping(&mut self, remapping: ImportRemapping)
Adds an import remapping.
Sourcepub fn source_map(&self) -> &'a SourceMap
pub fn source_map(&self) -> &'a SourceMap
Returns the source map.
Sourcepub fn current_dir(&self) -> &Path
pub fn current_dir(&self) -> &Path
Returns the current directory, or .
if it could not be resolved.
Sourcepub fn try_current_dir(&self) -> Option<&Path>
pub fn try_current_dir(&self) -> Option<&Path>
Returns the current directory, if resolved successfully.
Sourcepub fn canonicalize(&self, path: &Path) -> Result<PathBuf>
pub fn canonicalize(&self, path: &Path) -> Result<PathBuf>
Canonicalizes a path using Self::current_dir
.
Sourcepub fn normalize<'b>(&self, path: &'b Path) -> Cow<'b, Path>
pub fn normalize<'b>(&self, path: &'b Path) -> Cow<'b, Path>
Normalizes a path removing unnecessary components.
Does not perform I/O.
Sourcepub fn make_absolute<'b>(&self, path: &'b Path) -> Cow<'b, Path>
pub fn make_absolute<'b>(&self, path: &'b Path) -> Cow<'b, Path>
Makes the path absolute by joining it with the current directory.
Does not perform I/O.
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,
parent: Option<&Path>,
) -> Cow<'b, Path>
pub fn remap_path<'b>( &self, path: &'b Path, parent: Option<&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.
Trait Implementations§
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
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 112 bytes