Skip to main content

Path

Struct Path 

Source
pub struct Path(/* private fields */);
Expand description

A borrowed shared memory path.

It’s like &CStr, but syntactically valid.

Implementations§

Source§

impl Path

Source

pub const NAME_MAX: usize

Available on crate feature afc only.

The maximum number of bytes allowed in a Path.

Source

pub fn validate(path: &CStr) -> Result<(), InvalidPathError>

Available on crate feature afc only.

Checks whether path is valid.

A path is valid if it:

  • is at most NAME_MAX bytes
  • starts with “/”
  • has at most one “/”
  • has a trailing nul byte
Source

pub fn from_cstr(path: &CStr) -> Result<&Path, InvalidPathError>

Available on crate feature afc only.

Create a Path from a C string.

Source

pub fn from_bytes(path: &[u8]) -> Result<&Path, InvalidPathError>

Available on crate feature afc only.

Create a Path from bytes.

Trait Implementations§

Source§

impl AsRef<Path> for Path

Source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Box<Path>

Source§

fn clone(&self) -> Box<Path>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Path

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Box<Path>

Source§

fn deserialize<D>( deserializer: D, ) -> Result<Box<Path>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Path

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<&Path> for Box<Path>

Source§

fn from(path: &Path) -> Box<Path>

Converts to this type from the input type.
Source§

impl PartialEq for Path

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 Serialize for Path

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> TryFrom<&'a [u8]> for &'a Path

Source§

type Error = InvalidPathError

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

fn try_from( path: &'a [u8], ) -> Result<&'a Path, <&'a Path as TryFrom<&'a [u8]>>::Error>

Performs the conversion.
Source§

impl TryFrom<&[u8]> for Box<Path>

Source§

type Error = InvalidPathError

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

fn try_from( path: &[u8], ) -> Result<Box<Path>, <Box<Path> as TryFrom<&[u8]>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a CStr> for &'a Path

Source§

type Error = InvalidPathError

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

fn try_from( path: &'a CStr, ) -> Result<&'a Path, <&'a Path as TryFrom<&'a CStr>>::Error>

Performs the conversion.
Source§

impl TryFrom<&CStr> for Box<Path>

Source§

type Error = InvalidPathError

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

fn try_from( path: &CStr, ) -> Result<Box<Path>, <Box<Path> as TryFrom<&CStr>>::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for &'a Path

Source§

type Error = InvalidPathError

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

fn try_from( path: &'a str, ) -> Result<&'a Path, <&'a Path as TryFrom<&'a str>>::Error>

Performs the conversion.
Source§

impl TryFrom<&str> for Box<Path>

Source§

type Error = InvalidPathError

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

fn try_from( path: &str, ) -> Result<Box<Path>, <Box<Path> as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl TryFrom<Box<[u8]>> for Box<Path>

Source§

type Error = InvalidPathError

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

fn try_from( path: Box<[u8]>, ) -> Result<Box<Path>, <Box<Path> as TryFrom<Box<[u8]>>>::Error>

Performs the conversion.
Source§

impl TryFrom<Box<CStr>> for Box<Path>

Source§

type Error = InvalidPathError

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

fn try_from( path: Box<CStr>, ) -> Result<Box<Path>, <Box<Path> as TryFrom<Box<CStr>>>::Error>

Performs the conversion.
Source§

impl TryFrom<Box<str>> for Box<Path>

Source§

type Error = InvalidPathError

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

fn try_from( path: Box<str>, ) -> Result<Box<Path>, <Box<Path> as TryFrom<Box<str>>>::Error>

Performs the conversion.
Source§

impl TryFrom<CString> for Box<Path>

Source§

type Error = InvalidPathError

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

fn try_from( path: CString, ) -> Result<Box<Path>, <Box<Path> as TryFrom<CString>>::Error>

Performs the conversion.
Source§

impl TryFrom<String> for Box<Path>

Source§

type Error = InvalidPathError

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

fn try_from( path: String, ) -> Result<Box<Path>, <Box<Path> as TryFrom<String>>::Error>

Performs the conversion.
Source§

impl TryFrom<Vec<u8>> for Box<Path>

Source§

type Error = InvalidPathError

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

fn try_from( path: Vec<u8>, ) -> Result<Box<Path>, <Box<Path> as TryFrom<Vec<u8>>>::Error>

Performs the conversion.
Source§

impl Eq for Path

Auto Trait Implementations§

§

impl Freeze for Path

§

impl RefUnwindSafe for Path

§

impl Send for Path

§

impl !Sized for Path

§

impl Sync for Path

§

impl Unpin for Path

§

impl UnsafeUnpin for Path

§

impl UnwindSafe for Path

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more