[][src]Struct vfs::path::VfsPath

pub struct VfsPath { /* fields omitted */ }

A virtual filesystem path, identifying a single file or directory in this virtual filesystem

Implementations

impl VfsPath[src]

pub fn new<T: FileSystem>(filesystem: T) -> Self[src]

Creates a root path for the given filesystem

pub fn as_str(&self) -> &str[src]

Returns the string representation of this path

pub fn join(&self, path: &str) -> VfsResult<Self>[src]

Appends a path segment to this path, returning the result

pub fn read_dir(&self) -> VfsResult<Box<dyn Iterator<Item = VfsPath>>>[src]

Iterates over all entries of this directory path

pub fn create_dir(&self) -> VfsResult<()>[src]

Creates the directory at this path

Note that the parent directory must exist.

pub fn create_dir_all(&self) -> VfsResult<()>[src]

Creates the directory at this path, also creating parent directories as necessary

pub fn open_file(&self) -> VfsResult<Box<dyn SeekAndRead>>[src]

Opens the file at this path for reading

pub fn create_file(&self) -> VfsResult<Box<dyn Write>>[src]

Creates a file at this path for writing, overwriting any existing file

pub fn append_file(&self) -> VfsResult<Box<dyn Write>>[src]

Opens the file at this path for appending

pub fn remove_file(&self) -> VfsResult<()>[src]

Removes the file at this path

pub fn remove_dir(&self) -> VfsResult<()>[src]

Removes the directory at this path

The directory must be empty.

pub fn remove_dir_all(&self) -> VfsResult<()>[src]

Ensures that the directory at this path is removed, recursively deleting all contents if necessary

Returns successfully if directory does not exist

pub fn metadata(&self) -> VfsResult<VfsMetadata>[src]

Returns the file metadata for the file at this path

pub fn exists(&self) -> bool[src]

Returns true if a file or directory exists at this path, false otherwise

pub fn filename(&self) -> String[src]

Returns the filename portion of this path

pub fn extension(&self) -> Option<String>[src]

Returns the extension portion of this path

pub fn parent(&self) -> Option<Self>[src]

Returns the parent path of this portion of this path

Returns None if this is a root path

pub fn walk_dir(&self) -> VfsResult<WalkDirIterator>[src]

Recursively iterates over all the directories and files at this path

Directories are visited before their children

Note that the iterator items can contain errors, usually when directories are removed during the iteration. The returned paths may also point to non-existant files if there is concurrent removal.

Also note that loops in the file system hierarchy may cause this iterator to never terminate.

pub fn read_to_string(&self) -> VfsResult<String>[src]

Reads a complete file to a string

Returns an error if the file does not exist or is not valid UTF-8

pub fn copy_file(&self, destination: &VfsPath) -> VfsResult<()>[src]

Copies a file to a new destination

The destination must not exist, but its parent directory must

pub fn move_file(&self, destination: &VfsPath) -> VfsResult<()>[src]

Moves or renames a file to a new destination

The destination must not exist, but its parent directory must

pub fn copy_dir(&self, destination: &VfsPath) -> VfsResult<u64>[src]

Copies a directory to a new destination, recursively

The destination must not exist, but the parent directory must

Returns the number of files copied

pub fn move_dir(&self, destination: &VfsPath) -> VfsResult<()>[src]

Moves a directory to a new destination, including subdirectories and files

The destination must not exist, but its parent directory must

Trait Implementations

impl Clone for VfsPath[src]

impl Debug for VfsPath[src]

impl Eq for VfsPath[src]

impl<T: FileSystem> From<T> for VfsPath[src]

impl PartialEq<VfsPath> 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, 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.