[][src]Trait vfs::filesystem::FileSystem

pub trait FileSystem: Debug + Sync + Send + 'static {
    fn read_dir(
        &self,
        path: &str
    ) -> VfsResult<Box<dyn Iterator<Item = String>>>;
fn create_dir(&self, path: &str) -> VfsResult<()>;
fn open_file(&self, path: &str) -> VfsResult<Box<dyn SeekAndRead>>;
fn create_file(&self, path: &str) -> VfsResult<Box<dyn Write>>;
fn append_file(&self, path: &str) -> VfsResult<Box<dyn Write>>;
fn metadata(&self, path: &str) -> VfsResult<VfsMetadata>;
fn exists(&self, path: &str) -> bool;
fn remove_file(&self, path: &str) -> VfsResult<()>;
fn remove_dir(&self, path: &str) -> VfsResult<()>; fn copy_file(&self, _src: &str, _dest: &str) -> VfsResult<()> { ... }
fn move_file(&self, _src: &str, _dest: &str) -> VfsResult<()> { ... }
fn move_dir(&self, _src: &str, _dest: &str) -> VfsResult<()> { ... } }

File system implementations mus implement this trait

Required methods

fn read_dir(&self, path: &str) -> VfsResult<Box<dyn Iterator<Item = String>>>

Iterates over all entries of this directory path

fn create_dir(&self, path: &str) -> VfsResult<()>

Creates the directory at this path

Note that the parent directory must exist.

fn open_file(&self, path: &str) -> VfsResult<Box<dyn SeekAndRead>>

Opens the file at this path for reading

fn create_file(&self, path: &str) -> VfsResult<Box<dyn Write>>

Creates a file at this path for writing

fn append_file(&self, path: &str) -> VfsResult<Box<dyn Write>>

Opens the file at this path for appending

fn metadata(&self, path: &str) -> VfsResult<VfsMetadata>

Returns the file metadata for the file at this path

fn exists(&self, path: &str) -> bool

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

fn remove_file(&self, path: &str) -> VfsResult<()>

Removes the file at this path

fn remove_dir(&self, path: &str) -> VfsResult<()>

Removes the directory at this path

Loading content...

Provided methods

fn copy_file(&self, _src: &str, _dest: &str) -> VfsResult<()>

Copies the src path to the destination path within the same filesystem (optional)

fn move_file(&self, _src: &str, _dest: &str) -> VfsResult<()>

Moves the src path to the destination path within the same filesystem (optional)

fn move_dir(&self, _src: &str, _dest: &str) -> VfsResult<()>

Moves the src directory to the destination path within the same filesystem (optional)

Loading content...

Implementors

impl FileSystem for AltrootFS[src]

impl FileSystem for MemoryFS[src]

impl FileSystem for OverlayFS[src]

impl FileSystem for PhysicalFS[src]

Loading content...