pub struct PathMapper { /* private fields */ }Expand description
Pure string-based path mapper. No filesystem I/O.
Implementations§
Source§impl PathMapper
impl PathMapper
Sourcepub fn from_config(
config: &PathsConfig,
full_config: Option<&Config>,
) -> PathResult<Self>
pub fn from_config( config: &PathsConfig, full_config: Option<&Config>, ) -> PathResult<Self>
Create a PathMapper from configuration.
Resolves $ENV and ${config.ref} in mapping values.
The root path is resolved relative to the current working directory.
Sourcepub fn new() -> PathResult<Self>
pub fn new() -> PathResult<Self>
Create a PathMapper with default configuration.
Sourcepub fn normalize(&self, path: &str) -> PathResult<String>
pub fn normalize(&self, path: &str) -> PathResult<String>
Normalize a path to canonical internal form.
This function:
- Resolves prefixes (home:, project:, c:)
- Resolves . and ..
- Converts to forward slashes
- Validates sandbox (no escape above root)
Returns: Canonical path string (still virtual/internal)
Sourcepub fn normalize_all(&self, paths: Vec<String>) -> PathResult<Vec<String>>
pub fn normalize_all(&self, paths: Vec<String>) -> PathResult<Vec<String>>
Normalize multiple paths.
Sourcepub fn to_display(&self, canonical: &str) -> String
pub fn to_display(&self, canonical: &str) -> String
Convert canonical path to display format based on style.
Sourcepub fn to_filesystem_path(&self, canonical: &str) -> PathBuf
pub fn to_filesystem_path(&self, canonical: &str) -> PathBuf
Convert canonical path to actual filesystem path. This is where virtual paths become real OS paths.
Sourcepub fn from_filesystem_path(&self, fs_path: &Path) -> PathResult<String>
pub fn from_filesystem_path(&self, fs_path: &Path) -> PathResult<String>
Convert filesystem path back to canonical form.
Sourcepub fn has_prefix(&self, prefix: &str) -> bool
pub fn has_prefix(&self, prefix: &str) -> bool
Check if a prefix is defined in mappings.
Trait Implementations§
Source§impl Clone for PathMapper
impl Clone for PathMapper
Source§fn clone(&self) -> PathMapper
fn clone(&self) -> PathMapper
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PathMapper
impl Debug for PathMapper
Auto Trait Implementations§
impl Freeze for PathMapper
impl RefUnwindSafe for PathMapper
impl Send for PathMapper
impl Sync for PathMapper
impl Unpin for PathMapper
impl UnsafeUnpin for PathMapper
impl UnwindSafe for PathMapper
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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