struct VirtualPath(String);Expand description
/-separated virtual path.
This is used to describe files that do not reside on the file system.
Tuple Fields§
§0: StringImplementations§
Source§impl VirtualPath
impl VirtualPath
Sourcefn starts_with(&self, other: &VirtualPath) -> bool
fn starts_with(&self, other: &VirtualPath) -> bool
Returns true if other is a prefix of self (as strings).
fn strip_prefix(&self, base: &VirtualPath) -> Option<&RelPath>
Sourcefn pop(&mut self) -> bool
fn pop(&mut self) -> bool
Remove the last component of self.
This will find the last '/' in self, and remove everything after it,
including the '/'.
If self contains no '/', returns false; else returns true.
§Example
ⓘ
let mut path = VirtualPath("/foo/bar".to_string());
path.pop();
assert_eq!(path.0, "/foo");
path.pop();
assert_eq!(path.0, "");Sourcefn join(&self, path: &str) -> Option<VirtualPath>
fn join(&self, path: &str) -> Option<VirtualPath>
Sourcefn name_and_extension(&self) -> Option<(&str, Option<&str>)>
fn name_and_extension(&self) -> Option<(&str, Option<&str>)>
Returns self’s base name and file extension.
§Returns
Noneifselfends with"//".Some((name, None))ifself’s base contains no., or only one.at the start.Some((name, Some(extension))else.
§Note
The extension will not contains .. This means "/foo/bar.baz.rs" will
return Some(("bar.baz", Some("rs")).
Trait Implementations§
Source§impl Clone for VirtualPath
impl Clone for VirtualPath
Source§fn clone(&self) -> VirtualPath
fn clone(&self) -> VirtualPath
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VirtualPath
impl Debug for VirtualPath
Source§impl Hash for VirtualPath
impl Hash for VirtualPath
Source§impl Ord for VirtualPath
impl Ord for VirtualPath
Source§fn cmp(&self, other: &VirtualPath) -> Ordering
fn cmp(&self, other: &VirtualPath) -> Ordering
1.21.0 · 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 PartialEq for VirtualPath
impl PartialEq for VirtualPath
Source§impl PartialOrd for VirtualPath
impl PartialOrd for 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 Sync for VirtualPath
impl Unpin for VirtualPath
impl UnsafeUnpin 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more