Struct ra_ap_paths::AbsPathBuf
source · pub struct AbsPathBuf(_);Expand description
Wrapper around an absolute PathBuf.
Implementations§
source§impl AbsPathBuf
impl AbsPathBuf
sourcepub fn assert(path: PathBuf) -> AbsPathBuf
pub fn assert(path: PathBuf) -> AbsPathBuf
sourcepub fn as_path(&self) -> &AbsPath
pub fn as_path(&self) -> &AbsPath
Coerces to an AbsPath slice.
Equivalent of PathBuf::as_path for AbsPathBuf.
sourcepub fn pop(&mut self) -> bool
pub fn pop(&mut self) -> bool
Equivalent of PathBuf::pop for AbsPathBuf.
Note that this won’t remove the root component, so self will still be
absolute.
Methods from Deref<Target = 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//bbecomes/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§
source§impl AsRef<AbsPath> for AbsPathBuf
impl AsRef<AbsPath> for AbsPathBuf
source§impl AsRef<Path> for AbsPathBuf
impl AsRef<Path> for AbsPathBuf
source§impl Borrow<AbsPath> for AbsPathBuf
impl Borrow<AbsPath> for AbsPathBuf
source§impl Clone for AbsPathBuf
impl Clone for AbsPathBuf
source§fn clone(&self) -> AbsPathBuf
fn clone(&self) -> AbsPathBuf
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for AbsPathBuf
impl Debug for AbsPathBuf
source§impl Deref for AbsPathBuf
impl Deref for AbsPathBuf
source§impl From<AbsPathBuf> for PathBuf
impl From<AbsPathBuf> for PathBuf
source§fn from(AbsPathBuf: AbsPathBuf) -> PathBuf
fn from(AbsPathBuf: AbsPathBuf) -> PathBuf
Converts to this type from the input type.
source§impl Hash for AbsPathBuf
impl Hash for AbsPathBuf
source§impl Ord for AbsPathBuf
impl Ord for AbsPathBuf
source§fn cmp(&self, other: &AbsPathBuf) -> Ordering
fn cmp(&self, other: &AbsPathBuf) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<AbsPathBuf> for AbsPathBuf
impl PartialEq<AbsPathBuf> for AbsPathBuf
source§fn eq(&self, other: &AbsPathBuf) -> bool
fn eq(&self, other: &AbsPathBuf) -> bool
source§impl PartialOrd<AbsPathBuf> for AbsPathBuf
impl PartialOrd<AbsPathBuf> for AbsPathBuf
source§fn partial_cmp(&self, other: &AbsPathBuf) -> Option<Ordering>
fn partial_cmp(&self, other: &AbsPathBuf) -> Option<Ordering>
1.0.0 · source§fn 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