pub struct Path { /* private fields */ }Expand description
A slice of path (akin to str).
Different from [std::path::Path], this type is always
UTF-8 encoded.
Implementations§
Source§impl Path
impl Path
pub fn new<S: AsRef<str> + ?Sized>(s: &S) -> &Path
pub fn as_str(&self) -> &str
pub fn as_bytes(&self) -> &[u8]
Sourcepub fn components(&self) -> Components<'_>
pub fn components(&self) -> Components<'_>
Produces an iterator over the [Components] of the path.
Sourcepub fn file_name(&self) -> Option<&str>
pub fn file_name(&self) -> Option<&str>
Returns the final component of the Path, if there is one.
Sourcepub fn join(&self, other: impl AsRef<Path>) -> PathBuf
pub fn join(&self, other: impl AsRef<Path>) -> PathBuf
Creates an owned PathBuf with path adjoined to self.
Sourcepub fn parent(&self) -> Option<&Path>
pub fn parent(&self) -> Option<&Path>
Returns the Path without its final component, if there is one.
Sourcepub fn is_absolute(&self) -> bool
pub fn is_absolute(&self) -> bool
Returns true if the Path is absolute, i.e., if it is independent of
the current directory.
Trait Implementations§
Source§impl PartialOrd for Path
impl PartialOrd for Path
Source§impl ToOwned for Path
impl ToOwned for Path
impl Eq for Path
impl StructuralPartialEq 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 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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.