nu_path

Type Alias 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

Source§

fn from(s: &T) -> Self

Converts to this type from the input type.
Source§

impl From<Box<Path<Canonical>>> for AbsolutePathBuf

Source§

fn from(path: Box<CanonicalPath>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, Path<Canonical>>> for AbsolutePathBuf

Source§

fn from(cow: Cow<'_, CanonicalPath>) -> Self

Converts to this type from the input type.
Source§

impl From<PathBuf<Canonical>> for AbsolutePathBuf

Source§

fn from(buf: CanonicalPathBuf) -> Self

Converts to this type from the input type.
Source§

impl FromStr for AbsolutePathBuf

Source§

type Err = TryAbsoluteError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<'a> PartialEq<&'a Path<Canonical>> for AbsolutePathBuf

Source§

fn eq(&self, other: &&'a CanonicalPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&'a Path> for AbsolutePathBuf

Source§

fn eq(&self, other: &&'a Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<Cow<'a, Path<Canonical>>> for AbsolutePathBuf

Source§

fn eq(&self, other: &Cow<'a, CanonicalPath>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<Cow<'a, Path>> for AbsolutePathBuf

Source§

fn eq(&self, other: &Cow<'a, Path>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Path<Canonical>> for AbsolutePathBuf

Source§

fn eq(&self, other: &CanonicalPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Path> for AbsolutePathBuf

Source§

fn eq(&self, other: &Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<PathBuf<Canonical>> for AbsolutePathBuf

Source§

fn eq(&self, other: &CanonicalPathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<PathBuf> for AbsolutePathBuf

Source§

fn eq(&self, other: &PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialOrd<&'a Path<Canonical>> for AbsolutePathBuf

Source§

fn partial_cmp(&self, other: &&'a CanonicalPath) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a> PartialOrd<&'a Path> for AbsolutePathBuf

Source§

fn partial_cmp(&self, other: &&'a Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a> PartialOrd<Cow<'a, Path<Canonical>>> for AbsolutePathBuf

Source§

fn partial_cmp(&self, other: &Cow<'a, CanonicalPath>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a> PartialOrd<Cow<'a, Path>> for AbsolutePathBuf

Source§

fn partial_cmp(&self, other: &Cow<'a, Path>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Path<Canonical>> for AbsolutePathBuf

Source§

fn partial_cmp(&self, other: &CanonicalPath) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Path> for AbsolutePathBuf

Source§

fn partial_cmp(&self, other: &Path) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<PathBuf<Canonical>> for AbsolutePathBuf

Source§

fn partial_cmp(&self, other: &CanonicalPathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<PathBuf> for AbsolutePathBuf

Source§

fn partial_cmp(&self, other: &PathBuf) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TryFrom<&Component<'_>> for AbsolutePathBuf

Source§

type Error = TryAbsoluteError

The type returned in the event of a conversion error.
Source§

fn try_from(path: &Component<'_>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&Cow<'_, OsStr>> for AbsolutePathBuf

Source§

type Error = TryAbsoluteError

The type returned in the event of a conversion error.
Source§

fn try_from(path: &Cow<'_, OsStr>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&OsStr> for AbsolutePathBuf

Source§

type Error = TryAbsoluteError

The type returned in the event of a conversion error.
Source§

fn try_from(path: &OsStr) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&OsString> for AbsolutePathBuf

Source§

type Error = TryAbsoluteError

The type returned in the event of a conversion error.
Source§

fn try_from(path: &OsString) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&Path> for AbsolutePathBuf

Source§

type Error = TryAbsoluteError

The type returned in the event of a conversion error.
Source§

fn try_from(path: &Path) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&Path> for AbsolutePathBuf

Source§

type Error = TryAbsoluteError

The type returned in the event of a conversion error.
Source§

fn try_from(path: &Path) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&PathBuf> for AbsolutePathBuf

Source§

type Error = TryAbsoluteError

The type returned in the event of a conversion error.
Source§

fn try_from(path: &PathBuf) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&PathBuf> for AbsolutePathBuf

Source§

type Error = TryAbsoluteError

The type returned in the event of a conversion error.
Source§

fn try_from(path: &PathBuf) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&String> for AbsolutePathBuf

Source§

type Error = TryAbsoluteError

The type returned in the event of a conversion error.
Source§

fn try_from(path: &String) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&str> for AbsolutePathBuf

Source§

type Error = TryAbsoluteError

The type returned in the event of a conversion error.
Source§

fn try_from(path: &str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Box<Path>> for AbsolutePathBuf

Source§

type Error = Box<Path>

The type returned in the event of a conversion error.
Source§

fn try_from(path: Box<Path>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Box<Path>> for AbsolutePathBuf

Source§

type Error = Box<Path>

The type returned in the event of a conversion error.
Source§

fn try_from(path: Box<Path>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<Cow<'a, Path>> for AbsolutePathBuf

Source§

type Error = Cow<'a, Path>

The type returned in the event of a conversion error.
Source§

fn try_from(path: Cow<'a, Path>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<Cow<'a, Path>> for AbsolutePathBuf

Source§

type Error = Cow<'a, Path>

The type returned in the event of a conversion error.
Source§

fn try_from(path: Cow<'a, Path>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<OsString> for AbsolutePathBuf

Source§

type Error = OsString

The type returned in the event of a conversion error.
Source§

fn try_from(s: OsString) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<PathBuf> for AbsolutePathBuf

Source§

type Error = PathBuf

The type returned in the event of a conversion error.
Source§

fn try_from(buf: PathBuf) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<PathBuf> for AbsolutePathBuf

Source§

type Error = PathBuf

The type returned in the event of a conversion error.
Source§

fn try_from(buf: PathBuf) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<String> for AbsolutePathBuf

Source§

type Error = String

The type returned in the event of a conversion error.
Source§

fn try_from(s: String) -> Result<Self, Self::Error>

Performs the conversion.