pub struct RepoPath { /* private fields */ }
Expand description
Borrowed repository path.
Implementations§
source§impl RepoPath
impl RepoPath
sourcepub fn from_internal_string(value: &str) -> &Self
pub fn from_internal_string(value: &str) -> &Self
Wraps valid string representation as RepoPath
.
The input value
must not contain empty path components. For example,
"/"
, "/foo"
, "foo/"
, "foo//bar"
are all invalid.
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.