pub struct RelPathBuf(/* private fields */);Expand description
An owned representation of a file system path that is guaranteed to be relative and normalized.
This type is to RelPath as std::path::PathBuf is to std::path::Path
Implementations§
Source§impl RelPathBuf
impl RelPathBuf
Methods from Deref<Target = RelPath>§
pub fn is_empty(&self) -> bool
pub fn components(&self) -> RelPathComponents<'_> ⓘ
pub fn ancestors(&self) -> RelPathAncestors<'_> ⓘ
pub fn file_name(&self) -> Option<&str>
pub fn file_stem(&self) -> Option<&str>
pub fn extension(&self) -> Option<&str>
pub fn parent(&self) -> Option<&Self>
pub fn starts_with(&self, other: &Self) -> bool
Sourcepub fn is_descendant_of(&self, ancestor: &Self) -> bool
pub fn is_descendant_of(&self, ancestor: &Self) -> bool
Returns true if this path is a strict descendant of ancestor.
Unlike starts_with, this returns false when self == ancestor
and false when ancestor is empty (since every path trivially
starts with the empty prefix).
pub fn ends_with(&self, other: &Self) -> bool
pub fn strip_prefix<'a>( &'a self, other: &Self, ) -> Result<&'a Self, StripPrefixError>
pub fn len(&self) -> usize
pub fn last_n_components(&self, count: usize) -> Option<&Self>
pub fn join(&self, other: &Self) -> RelPathBuf
pub fn to_rel_path_buf(&self) -> RelPathBuf
pub fn into_arc(&self) -> Arc<Self> ⓘ
Sourcepub fn display(&self, style: PathStyle) -> Cow<'_, str>
pub fn display(&self, style: PathStyle) -> Cow<'_, str>
Convert the path into a string with the given path style.
Whenever a path is presented to the user, it should be converted to a string via this method.
Sourcepub fn as_unix_str(&self) -> &str
pub fn as_unix_str(&self) -> &str
Get the internal unix-style representation of the path.
This should not be shown to the user.
Sourcepub fn as_std_path(&self) -> &Path
pub fn as_std_path(&self) -> &Path
Interprets the path as a std::path::Path, suitable for file system calls.
This is guaranteed to be a valid path regardless of the host platform, because
the / is accepted as a path separator on windows.
This should not be shown to the user.
Sourcepub fn absolutize(&self, base: impl AsRef<AbsPath>) -> AbsPathBuf
pub fn absolutize(&self, base: impl AsRef<AbsPath>) -> AbsPathBuf
Resolves this relative path against an absolute base path.
Trait Implementations§
Source§impl AsRef<Path> for RelPathBuf
impl AsRef<Path> for RelPathBuf
Source§impl AsRef<RelPath> for RelPathBuf
impl AsRef<RelPath> for RelPathBuf
Source§impl Borrow<RelPath> for RelPathBuf
impl Borrow<RelPath> for RelPathBuf
Source§impl Clone for RelPathBuf
impl Clone for RelPathBuf
Source§fn clone(&self) -> RelPathBuf
fn clone(&self) -> RelPathBuf
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more