Skip to main content

ContainedFs

Trait ContainedFs 

Source
pub trait ContainedFs: Send + Sync {
    // Required methods
    fn walk(&self, path: &str) -> Result<FsHandle, FsError>;
    fn open(&self, path: &str, mode: OpenMode) -> Result<File, FsError>;
    fn create(&self, path: &str, mode: OpenMode) -> Result<File, FsError>;
    fn mkdir(&self, path: &str) -> Result<(), FsError>;
    fn mkdir_all(&self, path: &str) -> Result<(), FsError>;
    fn stat(&self, path: &str) -> Result<Stat, FsError>;
    fn rename(&self, src: &str, dst: &str) -> Result<(), FsError>;
    fn remove(&self, path: &str) -> Result<(), FsError>;
    fn readdir(&self, path: &str) -> Result<Vec<DirEntry>, FsError>;
    fn copy(&self, src: &str, dst: &str) -> Result<(), FsError>;
}
Expand description

Trait abstracting path-contained filesystem operations.

All paths passed to methods are relative to the contained root (forward-slash-separated &str, 9P convention). Implementations ensure no path can escape the root directory.

Required Methods§

Source

fn walk(&self, path: &str) -> Result<FsHandle, FsError>

Resolve a relative path and return an FsHandle for 9P walk state.

Source

fn open(&self, path: &str, mode: OpenMode) -> Result<File, FsError>

Open an existing file relative to the root.

Source

fn create(&self, path: &str, mode: OpenMode) -> Result<File, FsError>

Create a file relative to the root (implies open).

Source

fn mkdir(&self, path: &str) -> Result<(), FsError>

Create a single directory.

Source

fn mkdir_all(&self, path: &str) -> Result<(), FsError>

Create directories recursively.

Source

fn stat(&self, path: &str) -> Result<Stat, FsError>

Get file/directory metadata.

Source

fn rename(&self, src: &str, dst: &str) -> Result<(), FsError>

Rename a file or directory within the root.

Source

fn remove(&self, path: &str) -> Result<(), FsError>

Remove a file or empty directory.

Source

fn readdir(&self, path: &str) -> Result<Vec<DirEntry>, FsError>

List directory entries.

Source

fn copy(&self, src: &str, dst: &str) -> Result<(), FsError>

Copy a file (uses reflink/COW when available).

Implementors§