Type Alias nu_path::AbsolutePathBuf
source · pub type AbsolutePathBuf = PathBuf<Absolute>;Expand description
A path buf that is strictly absolute.
I.e., this path buf is guaranteed to never be relative.
§Examples
AbsolutePathBufs can be created by using try_into_absolute
on a PathBuf or by using to_path_buf on an AbsolutePath.
use nu_path::{AbsolutePath, AbsolutePathBuf, PathBuf};
let path_buf1 = PathBuf::from("/foo");
let path_buf1 = path_buf1.try_into_absolute().unwrap();
let path = AbsolutePath::try_new("/foo").unwrap();
let path_buf2 = path.to_path_buf();
assert_eq!(path_buf1, path_buf2);You can also use AbsolutePathBuf::try_from or try_into.
This supports attempted conversions from Path as well as types in std::path.
use nu_path::{AbsolutePathBuf, Path};
let path1 = AbsolutePathBuf::try_from("/foo").unwrap();
let path2 = Path::new("/foo");
let path2 = AbsolutePathBuf::try_from(path2).unwrap();
let path3 = std::path::PathBuf::from("/foo");
let path3: AbsolutePathBuf = path3.try_into().unwrap();
assert_eq!(path1, path2);
assert_eq!(path2, path3);Aliased Type§
struct AbsolutePathBuf { /* private fields */ }Trait Implementations§
source§impl<T: ?Sized + AsRef<AbsolutePath>> From<&T> for AbsolutePathBuf
impl<T: ?Sized + AsRef<AbsolutePath>> From<&T> for AbsolutePathBuf
source§impl From<Box<Path<Canonical>>> for AbsolutePathBuf
impl From<Box<Path<Canonical>>> for AbsolutePathBuf
source§fn from(path: Box<CanonicalPath>) -> Self
fn from(path: Box<CanonicalPath>) -> Self
Converts to this type from the input type.
source§impl From<Cow<'_, Path<Canonical>>> for AbsolutePathBuf
impl From<Cow<'_, Path<Canonical>>> for AbsolutePathBuf
source§fn from(cow: Cow<'_, CanonicalPath>) -> Self
fn from(cow: Cow<'_, CanonicalPath>) -> Self
Converts to this type from the input type.
source§impl From<PathBuf<Canonical>> for AbsolutePathBuf
impl From<PathBuf<Canonical>> for AbsolutePathBuf
source§fn from(buf: CanonicalPathBuf) -> Self
fn from(buf: CanonicalPathBuf) -> Self
Converts to this type from the input type.
source§impl FromStr for AbsolutePathBuf
impl FromStr for AbsolutePathBuf
source§impl<'a> PartialEq<&'a Path<Canonical>> for AbsolutePathBuf
impl<'a> PartialEq<&'a Path<Canonical>> for AbsolutePathBuf
source§fn eq(&self, other: &&'a CanonicalPath) -> bool
fn eq(&self, other: &&'a CanonicalPath) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl<'a> PartialEq<&'a Path> for AbsolutePathBuf
impl<'a> PartialEq<&'a Path> for AbsolutePathBuf
source§impl<'a> PartialEq<Cow<'a, Path<Canonical>>> for AbsolutePathBuf
impl<'a> PartialEq<Cow<'a, Path<Canonical>>> for AbsolutePathBuf
source§impl<'a> PartialEq<Cow<'a, Path>> for AbsolutePathBuf
impl<'a> PartialEq<Cow<'a, Path>> for AbsolutePathBuf
source§impl PartialEq<Path<Canonical>> for AbsolutePathBuf
impl PartialEq<Path<Canonical>> for AbsolutePathBuf
source§fn eq(&self, other: &CanonicalPath) -> bool
fn eq(&self, other: &CanonicalPath) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialEq<Path> for AbsolutePathBuf
impl PartialEq<Path> for AbsolutePathBuf
source§impl PartialEq<PathBuf<Canonical>> for AbsolutePathBuf
impl PartialEq<PathBuf<Canonical>> for AbsolutePathBuf
source§fn eq(&self, other: &CanonicalPathBuf) -> bool
fn eq(&self, other: &CanonicalPathBuf) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialEq<PathBuf> for AbsolutePathBuf
impl PartialEq<PathBuf> for AbsolutePathBuf
source§impl<'a> PartialOrd<&'a Path<Canonical>> for AbsolutePathBuf
impl<'a> PartialOrd<&'a Path<Canonical>> for AbsolutePathBuf
source§fn partial_cmp(&self, other: &&'a CanonicalPath) -> Option<Ordering>
fn partial_cmp(&self, other: &&'a CanonicalPath) -> 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 moresource§impl<'a> PartialOrd<&'a Path> for AbsolutePathBuf
impl<'a> PartialOrd<&'a Path> for AbsolutePathBuf
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 moresource§impl<'a> PartialOrd<Cow<'a, Path<Canonical>>> for AbsolutePathBuf
impl<'a> PartialOrd<Cow<'a, Path<Canonical>>> for AbsolutePathBuf
source§fn partial_cmp(&self, other: &Cow<'a, CanonicalPath>) -> Option<Ordering>
fn partial_cmp(&self, other: &Cow<'a, CanonicalPath>) -> 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 moresource§impl<'a> PartialOrd<Cow<'a, Path>> for AbsolutePathBuf
impl<'a> PartialOrd<Cow<'a, Path>> for AbsolutePathBuf
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 moresource§impl PartialOrd<Path<Canonical>> for AbsolutePathBuf
impl PartialOrd<Path<Canonical>> for AbsolutePathBuf
source§fn partial_cmp(&self, other: &CanonicalPath) -> Option<Ordering>
fn partial_cmp(&self, other: &CanonicalPath) -> 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 moresource§impl PartialOrd<Path> for AbsolutePathBuf
impl PartialOrd<Path> for AbsolutePathBuf
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 moresource§impl PartialOrd<PathBuf<Canonical>> for AbsolutePathBuf
impl PartialOrd<PathBuf<Canonical>> for AbsolutePathBuf
source§fn partial_cmp(&self, other: &CanonicalPathBuf) -> Option<Ordering>
fn partial_cmp(&self, other: &CanonicalPathBuf) -> 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 moresource§impl PartialOrd<PathBuf> for AbsolutePathBuf
impl PartialOrd<PathBuf> for AbsolutePathBuf
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