pub struct VirtualPath { /* private fields */ }Expand description
A wrapper type that allows doing path operations on strings, without considerations for any concrete file system. These paths are supposed to be absolute and should start with a ‘/’.
Implementations§
Source§impl VirtualPath
impl VirtualPath
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
alias for Self::is_root
Sourcepub fn chroot(&self, new_root: &VirtualPath) -> Result<&Self, VirtualPathError>
pub fn chroot(&self, new_root: &VirtualPath) -> Result<&Self, VirtualPathError>
Return a new VirtualPath with a new root
Sourcepub fn is_inside(&self, other: &VirtualPath) -> bool
pub fn is_inside(&self, other: &VirtualPath) -> bool
Return true if the node pointed by “self” is contained in “other”, eventually recursively Return also true if self == other
Sourcepub fn top_level(&self) -> Option<&str>
pub fn top_level(&self) -> Option<&str>
Return the top level directory of this path, for example “a” in “/a/b/c”. Return None is
the provided path is the root
Sourcepub fn top_level_split(&self) -> Option<(&str, &Self)>
pub fn top_level_split(&self) -> Option<(&str, &Self)>
Return the path split in two components, the top level and the rest. For example, the path “a/b/c” will return Some(“a”, “/b/c”). Return None when called on a root path.
Sourcepub fn iter(&self) -> VirtualPathIterator<'_> ⓘ
pub fn iter(&self) -> VirtualPathIterator<'_> ⓘ
Return an iterator over the components of the path
Trait Implementations§
Source§impl AsRef<Path> for VirtualPath
impl AsRef<Path> for VirtualPath
Source§impl AsRef<VirtualPath> for VirtualPathBuf
impl AsRef<VirtualPath> for VirtualPathBuf
Source§fn as_ref(&self) -> &VirtualPath
fn as_ref(&self) -> &VirtualPath
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Borrow<VirtualPath> for VirtualPathBuf
impl Borrow<VirtualPath> for VirtualPathBuf
Source§fn borrow(&self) -> &VirtualPath
fn borrow(&self) -> &VirtualPath
Immutably borrows from an owned value. Read more
Source§impl Debug for VirtualPath
impl Debug for VirtualPath
Source§impl<'a> From<&'a VirtualPath> for &'a str
impl<'a> From<&'a VirtualPath> for &'a str
Source§fn from(value: &'a VirtualPath) -> Self
fn from(value: &'a VirtualPath) -> Self
Converts to this type from the input type.
Source§impl Ord for VirtualPath
impl Ord for VirtualPath
Source§impl<'a> PartialEq<&'a VirtualPath> for VirtualPathBuf
impl<'a> PartialEq<&'a VirtualPath> for VirtualPathBuf
Source§impl PartialEq<VirtualPathBuf> for &VirtualPath
impl PartialEq<VirtualPathBuf> for &VirtualPath
Source§impl PartialEq for VirtualPath
impl PartialEq for VirtualPath
Source§impl PartialOrd for VirtualPath
impl PartialOrd for VirtualPath
Source§impl ToOwned for VirtualPath
impl ToOwned for VirtualPath
Source§type Owned = VirtualPathBuf
type Owned = VirtualPathBuf
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more
Source§impl<'a> TryFrom<&'a str> for &'a VirtualPath
impl<'a> TryFrom<&'a str> for &'a VirtualPath
impl Eq for VirtualPath
impl StructuralPartialEq for VirtualPath
Auto Trait Implementations§
impl Freeze for VirtualPath
impl RefUnwindSafe for VirtualPath
impl Send for VirtualPath
impl !Sized for VirtualPath
impl Sync for VirtualPath
impl Unpin for VirtualPath
impl UnwindSafe for VirtualPath
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§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.