pub struct OwnedPath<State: PathState> { /* private fields */ }Available on
Linux only.Implementations§
Methods from Deref<Target = Path<S>>§
pub fn display<'a>(&'a self) -> DisplayPath<'a, S>
pub fn len(&self) -> NonZero<usize>
pub fn as_os_str(&self) -> &OsStr
pub fn as_os_str_no_lead(&self) -> &OsStr
pub fn as_bytes(&self) -> &[u8] ⓘ
Sourcepub fn basename(&self) -> &OsStr
pub fn basename(&self) -> &OsStr
Returns the basename of this path (the OsStr following the last / in the path). This OsStr
won’t contain any instances of /.
See parent() for more info.
Sourcepub fn parent(&self) -> &Self
pub fn parent(&self) -> &Self
Returns the parent directory of this path (lexically speaking). The result is a Path with
basename and the preceding slash removed, such that the following holds for any path.
let owned = OwnedPath::<Abs>::from("/my/path");
let path: &Path<Abs> = &owned;
let new_path = path.parent().join(Path::new(path.basename()));
assert_eq!(path, new_path);Because this method is the counterpart of basename and basename won’t
contain any /, the behavior when calling these methods on "/" is as follows:
assert_eq!(Path::root().basename(), "");
assert_eq!(Path::root().parent(), Path::root());This behavior is also consistent with Unix defaults: the .. entry in the root directory
refers to the root itself.
pub fn join<P: AsRef<Path<Rel>>>(&self, other: P) -> OwnedPath<S>
pub fn relative_to(&self, other: &Self) -> Option<&Path<Rel>>
Sourcepub fn components<'a>(&'a self) -> Components<'a, S> ⓘ
pub fn components<'a>(&'a self) -> Components<'a, S> ⓘ
Creates an Iterator over the components of a Path. This iterator produces Path<Rel>s
representing each /-separated string in the Path, from left to right.
Trait Implementations§
Source§impl<S: PathState> Ord for OwnedPath<S>
impl<S: PathState> Ord for OwnedPath<S>
Source§impl<S: PathState> PartialOrd<OwnedPath<S>> for Path<S>
impl<S: PathState> PartialOrd<OwnedPath<S>> for Path<S>
Source§impl<S: PathState> PartialOrd<Path<S>> for OwnedPath<S>
impl<S: PathState> PartialOrd<Path<S>> for OwnedPath<S>
Source§impl<S: PathState> PartialOrd for OwnedPath<S>
impl<S: PathState> PartialOrd for OwnedPath<S>
impl<S: PathState> Eq for OwnedPath<S>
Auto Trait Implementations§
impl<State> Freeze for OwnedPath<State>
impl<State> RefUnwindSafe for OwnedPath<State>
impl<State> Send for OwnedPath<State>
impl<State> Sync for OwnedPath<State>
impl<State> Unpin for OwnedPath<State>
impl<State> UnwindSafe for OwnedPath<State>
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