pub struct Path(/* private fields */);Expand description
A borrowed shared memory path.
It’s like &CStr, but syntactically valid.
Implementations§
Source§impl Path
impl Path
Sourcepub const NAME_MAX: usize
Available on crate feature afc only.
pub const NAME_MAX: usize
afc only.The maximum number of bytes allowed in a Path.
Sourcepub fn validate(path: &CStr) -> Result<(), InvalidPathError>
Available on crate feature afc only.
pub fn validate(path: &CStr) -> Result<(), InvalidPathError>
afc only.Checks whether path is valid.
A path is valid if it:
- is at most
NAME_MAXbytes - starts with “/”
- has at most one “/”
- has a trailing nul byte
Sourcepub fn from_cstr(path: &CStr) -> Result<&Path, InvalidPathError>
Available on crate feature afc only.
pub fn from_cstr(path: &CStr) -> Result<&Path, InvalidPathError>
afc only.Create a Path from a C string.
Sourcepub fn from_bytes(path: &[u8]) -> Result<&Path, InvalidPathError>
Available on crate feature afc only.
pub fn from_bytes(path: &[u8]) -> Result<&Path, InvalidPathError>
afc only.Create a Path from bytes.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Box<Path>
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>,
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 Serialize for Path
impl Serialize for Path
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
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
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.