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§
Source§impl Clone for RepoPathUiConverter
impl Clone for RepoPathUiConverter
Source§fn clone(&self) -> RepoPathUiConverter
fn clone(&self) -> RepoPathUiConverter
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto 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> 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