[][src]Struct vfsys::VirtualFileSystem

pub struct VirtualFileSystem { /* fields omitted */ }

A reference to an virtual file system.

Implementations

impl VirtualFileSystem[src]

pub fn try_new<P: AsRef<Path>>(root: P) -> Result<Self>[src]

Creates new VirtualFileSystem.

root - base directory for VFS. A root path must exists; else return value will be io::Error. It will be normalized.

pub fn root(&self) -> PathBuf[src]

Returns a root path.

pub fn absolute<P: AsRef<Path>>(&self, path: P) -> Option<PathBuf>[src]

Convert relative path to absolute.

If path is absolute and starts with current root, then return it, else return None. If path is relative, then append it to the end of the current root and return joined path.

pub fn relative<P: AsRef<Path>>(&self, path: P) -> Option<PathBuf>[src]

Convert absolute path to relative.

If path is relative, then normalize it and return. If path is equal to root, then return . (current). If root equals to /foo/bar and path equals to /foo/bar/more, then return more.

pub fn exists<P: AsRef<Path>>(&self, path: P) -> bool[src]

Returns true if the path points at an existing entity.

pub fn chroot<P: AsRef<Path>>(&mut self, new_root: P) -> bool[src]

Change current root.

A new_root path may be absolute or relative. Return true if root was change.

pub fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>[src]

Creates a new, empty directory at the provided path.

pub fn create_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>[src]

Recursively create a directory and all of its parent components if they are missing.

pub fn remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>[src]

Removes an existing, empty directory.

pub fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>[src]

Removes a directory at this path, after removing all its contents. Use carefully!

pub fn visit_all(&self, cb: &dyn Fn(&DirEntry)) -> Result<()>[src]

Recursively traverses the contents of the directory and calls a callback for each item.

Auto Trait Implementations

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, 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.