Skip to main content

FileSystem

Trait FileSystem 

Source
pub trait FileSystem {
    // Required methods
    fn walk_markdown(&self, root: &Path) -> Result<Vec<String>>;
    fn stat(&self, root: &Path, path: &str) -> Result<Option<FileStat>>;
    fn read(&self, root: &Path, path: &str) -> Result<Option<String>>;

    // Provided method
    fn exists(&self, root: &Path, path: &str) -> Result<bool> { ... }
}
Expand description

Where the fast path’s bytes come from. Paths are repo-relative with / separators; every method takes the repo root.

Required Methods§

Source

fn walk_markdown(&self, root: &Path) -> Result<Vec<String>>

§4.2: every regular file named *.md at any depth under root, skipping IGNORED_DIRS, depth-first with each directory’s entries in bytewise name order.

Source

fn stat(&self, root: &Path, path: &str) -> Result<Option<FileStat>>

(mtime_ns, size) of path under root; None when absent.

Source

fn read(&self, root: &Path, path: &str) -> Result<Option<String>>

The bytes at path as text; None when absent.

Provided Methods§

Source

fn exists(&self, root: &Path, path: &str) -> Result<bool>

Whether path exists under root.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§