Struct jj_lib::repo_path::RepoPathBuf
source · pub struct RepoPathBuf { /* private fields */ }Expand description
Owned repository path.
Implementations§
source§impl RepoPathBuf
impl RepoPathBuf
sourcepub fn from_internal_string(value: impl Into<String>) -> Self
pub fn from_internal_string(value: impl Into<String>) -> Self
Creates RepoPathBuf from valid string representation.
The input value must not contain empty path components. For example,
"/", "/foo", "foo/", "foo//bar" are all invalid.
sourcepub fn from_relative_path(
relative_path: impl AsRef<Path>,
) -> Result<Self, RelativePathParseError>
pub fn from_relative_path( relative_path: impl AsRef<Path>, ) -> Result<Self, RelativePathParseError>
Converts repo-relative Path to RepoPathBuf.
The input path should not contain redundant . or ...
sourcepub fn parse_fs_path(
cwd: &Path,
base: &Path,
input: impl AsRef<Path>,
) -> Result<Self, FsPathParseError>
pub fn parse_fs_path( cwd: &Path, base: &Path, input: impl AsRef<Path>, ) -> Result<Self, FsPathParseError>
Parses an input path into a RepoPathBuf relative to base.
The cwd and base paths are supposed to be absolute and normalized in
the same manner. The input path may be either relative to cwd or
absolute.
sourcepub fn into_internal_string(self) -> String
pub fn into_internal_string(self) -> String
Consumes this and returns the underlying string representation.
Methods from Deref<Target = RepoPath>§
sourcepub fn to_internal_dir_string(&self) -> String
pub fn to_internal_dir_string(&self) -> String
The full string form used internally, not for presenting to users (where we may want to use the platform’s separator). This format includes a trailing slash, unless this path represents the root directory. That way it can be concatenated with a basename and produce a valid path.
sourcepub fn as_internal_file_string(&self) -> &str
pub fn as_internal_file_string(&self) -> &str
The full string form used internally, not for presenting to users (where we may want to use the platform’s separator).
pub fn to_fs_path(&self, base: &Path) -> PathBuf
pub fn is_root(&self) -> bool
sourcepub fn starts_with(&self, base: &RepoPath) -> bool
pub fn starts_with(&self, base: &RepoPath) -> bool
Returns true if the base is a prefix of this path.
sourcepub fn strip_prefix(&self, base: &RepoPath) -> Option<&RepoPath>
pub fn strip_prefix(&self, base: &RepoPath) -> Option<&RepoPath>
Returns the remaining path with the base path removed.
sourcepub fn parent(&self) -> Option<&RepoPath>
pub fn parent(&self) -> Option<&RepoPath>
Returns the parent path without the base name component.
sourcepub fn split(&self) -> Option<(&RepoPath, &RepoPathComponent)>
pub fn split(&self) -> Option<(&RepoPath, &RepoPathComponent)>
Splits this into the parent path and base name component.
pub fn components(&self) -> RepoPathComponentsIter<'_> ⓘ
pub fn join(&self, entry: &RepoPathComponent) -> RepoPathBuf
Trait Implementations§
source§impl AsRef<RepoPath> for RepoPathBuf
impl AsRef<RepoPath> for RepoPathBuf
source§impl Borrow<RepoPath> for RepoPathBuf
impl Borrow<RepoPath> for RepoPathBuf
source§impl Clone for RepoPathBuf
impl Clone for RepoPathBuf
source§fn clone(&self) -> RepoPathBuf
fn clone(&self) -> RepoPathBuf
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for RepoPathBuf
impl Debug for RepoPathBuf
source§impl Deref for RepoPathBuf
impl Deref for RepoPathBuf
source§impl Hash for RepoPathBuf
impl Hash for RepoPathBuf
source§impl Ord for RepoPathBuf
impl Ord for RepoPathBuf
source§impl PartialEq for RepoPathBuf
impl PartialEq for RepoPathBuf
source§fn eq(&self, other: &RepoPathBuf) -> bool
fn eq(&self, other: &RepoPathBuf) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd for RepoPathBuf
impl PartialOrd for RepoPathBuf
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Eq for RepoPathBuf
impl StructuralPartialEq for RepoPathBuf
Auto Trait Implementations§
impl Freeze for RepoPathBuf
impl RefUnwindSafe for RepoPathBuf
impl Send for RepoPathBuf
impl Sync for RepoPathBuf
impl Unpin for RepoPathBuf
impl UnwindSafe for RepoPathBuf
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more