Struct ra_ap_paths::AbsPath
source · [−]#[repr(transparent)]pub struct AbsPath(_);
Expand description
Wrapper around an absolute Path
.
Implementations
sourceimpl AbsPath
impl AbsPath
sourcepub fn parent(&self) -> Option<&AbsPath>
pub fn parent(&self) -> Option<&AbsPath>
Equivalent of Path::parent
for AbsPath
.
sourcepub fn join(&self, path: impl AsRef<Path>) -> AbsPathBuf
pub fn join(&self, path: impl AsRef<Path>) -> AbsPathBuf
Equivalent of Path::join
for AbsPath
.
sourcepub fn normalize(&self) -> AbsPathBuf
pub fn normalize(&self) -> AbsPathBuf
Normalize the given path:
- Removes repeated separators:
/a//b
becomes/a/b
- Removes occurrences of
.
and resolves..
. - Removes trailing slashes:
/a/b/
becomes/a/b
.
Example
let abs_path_buf = AbsPathBuf::assert("/a/../../b/.//c//".into());
let normalized = abs_path_buf.normalize();
assert_eq!(normalized, AbsPathBuf::assert("/b/c".into()));
sourcepub fn to_path_buf(&self) -> AbsPathBuf
pub fn to_path_buf(&self) -> AbsPathBuf
Equivalent of Path::to_path_buf
for AbsPath
.
sourcepub fn strip_prefix(&self, base: &AbsPath) -> Option<&RelPath>
pub fn strip_prefix(&self, base: &AbsPath) -> Option<&RelPath>
Equivalent of Path::strip_prefix
for AbsPath
.
Returns a relative path.
pub fn starts_with(&self, base: &AbsPath) -> bool
pub fn ends_with(&self, suffix: &RelPath) -> bool
pub fn file_name(&self) -> Option<&OsStr>
pub fn extension(&self) -> Option<&OsStr>
pub fn file_stem(&self) -> Option<&OsStr>
pub fn as_os_str(&self) -> &OsStr
pub fn display(&self) -> Display<'_>
pub fn exists(&self) -> bool
👎 Deprecated:
use std::fs::metadata().is_ok() instead
Trait Implementations
sourceimpl AsRef<AbsPath> for AbsPathBuf
impl AsRef<AbsPath> for AbsPathBuf
sourceimpl Borrow<AbsPath> for AbsPathBuf
impl Borrow<AbsPath> for AbsPathBuf
sourceimpl Ord for AbsPath
impl Ord for AbsPath
sourceimpl PartialEq<AbsPath> for AbsPathBuf
impl PartialEq<AbsPath> for AbsPathBuf
sourceimpl PartialOrd<AbsPath> for AbsPath
impl PartialOrd<AbsPath> for AbsPath
sourcefn partial_cmp(&self, other: &AbsPath) -> Option<Ordering>
fn partial_cmp(&self, other: &AbsPath) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more