Enum jj_lib::repo_path::RepoPathUiConverter
source · pub enum RepoPathUiConverter {
Fs {
cwd: PathBuf,
base: PathBuf,
},
}
Expand description
Converts RepoPath
s to and from plain strings as displayed to the user
(e.g. relative to CWD).
Variants§
Fs
Variant for a local file system. Paths are interpreted relative to cwd
with the repo rooted in base
.
The cwd
and base
paths are supposed to be absolute and normalized in
the same manner.
Implementations§
source§impl RepoPathUiConverter
impl RepoPathUiConverter
sourcepub fn format_file_path(&self, file: &RepoPath) -> String
pub fn format_file_path(&self, file: &RepoPath) -> String
Format a path for display in the UI.
sourcepub fn format_copied_path(&self, source: &RepoPath, target: &RepoPath) -> String
pub fn format_copied_path(&self, source: &RepoPath, target: &RepoPath) -> String
Format a copy from source
to target
for display in the UI by
extracting common components and producing something like
“common/prefix/{source => target}/common/suffix”.
If source == target
, returns format_file_path(source)
.
sourcepub fn parse_file_path(
&self,
input: &str,
) -> Result<RepoPathBuf, UiPathParseError>
pub fn parse_file_path( &self, input: &str, ) -> Result<RepoPathBuf, UiPathParseError>
Parses a path from the UI.
It’s up to the implementation whether absolute paths are allowed, and where relative paths are interpreted as relative to.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RepoPathUiConverter
impl RefUnwindSafe for RepoPathUiConverter
impl Send for RepoPathUiConverter
impl Sync for RepoPathUiConverter
impl Unpin for RepoPathUiConverter
impl UnwindSafe for RepoPathUiConverter
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> 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