pub struct RelPath(/* private fields */);Expand description
A declared path that is relative to a section root and cannot leave it.
The value is normalized the way Python’s Path(value) does it: empty and .
components are dropped, so "a//b/./c/" and "a/b/c" are the same path, and both
"" and "." are the root. Absolute paths and any .. component are rejected:
a level declares paths, not locations, and a .. could let it read or write
outside the workspace.
Implementations§
Source§impl RelPath
impl RelPath
Sourcepub fn components(&self) -> impl DoubleEndedIterator<Item = &str>
pub fn components(&self) -> impl DoubleEndedIterator<Item = &str>
The path components, outermost first.
Sourcepub fn parent(&self) -> Option<RelPath>
pub fn parent(&self) -> Option<RelPath>
The path without its last component, or None for the root.
Sourcepub fn starts_with(&self, other: &RelPath) -> bool
pub fn starts_with(&self, other: &RelPath) -> bool
True when self is other or lies below it (component-wise, so maze2 is not
inside maze). Every path is inside the root.
Trait Implementations§
impl Eq for RelPath
Source§impl Ord for RelPath
impl Ord for RelPath
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for RelPath
impl PartialOrd for RelPath
impl StructuralPartialEq for RelPath
Auto Trait Implementations§
impl Freeze for RelPath
impl RefUnwindSafe for RelPath
impl Send for RelPath
impl Sync for RelPath
impl Unpin for RelPath
impl UnsafeUnpin for RelPath
impl UnwindSafe for RelPath
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§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.