pub struct FilePathMapping {
mapping: Vec<(PathBuf, PathBuf)>,
filename_display_for_diagnostics: FileNameDisplayPreference,
}
Fields§
§mapping: Vec<(PathBuf, PathBuf)>
§filename_display_for_diagnostics: FileNameDisplayPreference
Implementations§
Source§impl FilePathMapping
impl FilePathMapping
pub fn empty() -> FilePathMapping
pub fn new( mapping: Vec<(PathBuf, PathBuf)>, filename_display_for_diagnostics: FileNameDisplayPreference, ) -> FilePathMapping
Sourcepub fn map_prefix<'a>(
&'a self,
path: impl Into<Cow<'a, Path>>,
) -> (Cow<'a, Path>, bool)
pub fn map_prefix<'a>( &'a self, path: impl Into<Cow<'a, Path>>, ) -> (Cow<'a, Path>, bool)
Applies any path prefix substitution as defined by the mapping. The return value is the remapped path and a boolean indicating whether the path was affected by the mapping.
fn map_filename_prefix(&self, file: &FileName) -> (FileName, bool)
Sourcepub fn to_real_filename<'a>(
&self,
local_path: impl Into<Cow<'a, Path>>,
) -> RealFileName
pub fn to_real_filename<'a>( &self, local_path: impl Into<Cow<'a, Path>>, ) -> RealFileName
Applies any path prefix substitution as defined by the mapping. The return value is the local path with a “virtual path” representing the remapped part if any remapping was performed.
Sourcepub fn to_embeddable_absolute_path(
&self,
file_path: RealFileName,
working_directory: &RealFileName,
) -> RealFileName
pub fn to_embeddable_absolute_path( &self, file_path: RealFileName, working_directory: &RealFileName, ) -> RealFileName
Expand a relative path to an absolute path with remapping taken into account. Use this when absolute paths are required (e.g. debuginfo or crate metadata).
The resulting RealFileName
will have its local_path
portion erased if
possible (i.e. if there’s also a remapped path).
Sourcepub fn to_local_embeddable_absolute_path(
&self,
file_path: RealFileName,
working_directory: &RealFileName,
) -> RealFileName
pub fn to_local_embeddable_absolute_path( &self, file_path: RealFileName, working_directory: &RealFileName, ) -> RealFileName
Expand a relative path to an absolute path without remapping taken into account.
The resulting RealFileName
will have its virtual_path
portion erased if
possible (i.e. if there’s also a remapped path).
Sourcefn reverse_map_prefix_heuristically(&self, path: &Path) -> Option<PathBuf>
fn reverse_map_prefix_heuristically(&self, path: &Path) -> Option<PathBuf>
Attempts to (heuristically) reverse a prefix mapping.
Returns Some
if there is exactly one mapping where the “to” part is
a prefix of path
and has at least one non-empty
Normal
component. The component
restriction exists to avoid reverse mapping overly generic paths like
/
or .
).
This is a heuristic and not guaranteed to return the actual original path! Do not rely on the result unless you have other means to verify that the mapping is correct (e.g. by checking the file content hash).
Trait Implementations§
Source§impl Clone for FilePathMapping
impl Clone for FilePathMapping
Source§fn clone(&self) -> FilePathMapping
fn clone(&self) -> FilePathMapping
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl DynSend for FilePathMapping
impl DynSync for FilePathMapping
impl Freeze for FilePathMapping
impl RefUnwindSafe for FilePathMapping
impl Send for FilePathMapping
impl Sync for FilePathMapping
impl Unpin for FilePathMapping
impl UnwindSafe for FilePathMapping
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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: 32 bytes