Struct ra_ap_vfs::VfsPath[][src]

pub struct VfsPath(_);

Path in Vfs.

Long-term, we want to support files which do not reside in the file-system, so we treat VfsPaths 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]

impl Hash for VfsPath[src]

impl Ord for VfsPath[src]

impl PartialEq<VfsPath> for VfsPath[src]

impl PartialOrd<VfsPath> for VfsPath[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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.