Struct ra_ap_vfs::VfsPath [−][src]
Path in Vfs
.
Long-term, we want to support files which do not reside in the file-system,
so we treat VfsPath
s as opaque identifiers.
Implementations
impl VfsPath
[src]
pub fn new_virtual_path(path: String) -> VfsPath
[src]
Creates an “in-memory” path from /
-separated string.
This is most useful for testing, to avoid windows/linux differences
Panics
Panics if path
does not start with '/'
.
pub fn as_path(&self) -> Option<&AbsPath>
[src]
Returns the AbsPath
representation of self
if self
is on the file system.
pub fn join(&self, path: &str) -> Option<VfsPath>
[src]
Creates a new VfsPath
with path
adjoined to self
.
pub fn pop(&mut self) -> bool
[src]
Remove the last component of self
if there is one.
If self
has no component, returns false
; else returns true
.
Example
let mut path = VfsPath::from(AbsPathBuf::assert("/foo/bar".into())); assert!(path.pop()); assert_eq!(path, VfsPath::from(AbsPathBuf::assert("/foo".into()))); assert!(path.pop()); assert_eq!(path, VfsPath::from(AbsPathBuf::assert("/".into()))); assert!(!path.pop());
pub fn starts_with(&self, other: &VfsPath) -> bool
[src]
Returns true
if other
is a prefix of self
.
pub fn parent(&self) -> Option<VfsPath>
[src]
Returns the VfsPath
without its final component, if there is one.
Returns None
if the path is a root or prefix.
pub fn name_and_extension(&self) -> Option<(&str, Option<&str>)>
[src]
Returns self
’s base name and file extension.
Trait Implementations
impl Clone for VfsPath
[src]
impl Debug for VfsPath
[src]
impl Display for VfsPath
[src]
impl Eq for VfsPath
[src]
impl From<AbsPathBuf> for VfsPath
[src]
fn from(v: AbsPathBuf) -> Self
[src]
impl Hash for VfsPath
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for VfsPath
[src]
fn cmp(&self, other: &VfsPath) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<VfsPath> for VfsPath
[src]
impl PartialOrd<VfsPath> for VfsPath
[src]
fn partial_cmp(&self, other: &VfsPath) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for VfsPath
[src]
impl StructuralPartialEq for VfsPath
[src]
Auto Trait Implementations
impl RefUnwindSafe for VfsPath
impl Send for VfsPath
impl Sync for VfsPath
impl Unpin for VfsPath
impl UnwindSafe for VfsPath
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,