Skip to main content

DirReader

Trait DirReader 

Source
pub trait DirReader {
    // Required methods
    fn read_dir(&self, path: &Path) -> Result<Vec<DirEntry>>;
    fn read_file(&self, path: &Path) -> Result<Vec<u8>>;
    fn is_executable(&self, path: &Path) -> Result<bool>;
    fn is_ignored(&self, path: &Path, is_dir: bool) -> bool;
    fn mtime_ms(&self, path: &Path) -> Result<Option<u64>>;
}
Expand description

Filesystem abstraction so substrate can drive traversal without doing I/O itself.

Required Methods§

Source

fn read_dir(&self, path: &Path) -> Result<Vec<DirEntry>>

List immediate children of a directory.

Source

fn read_file(&self, path: &Path) -> Result<Vec<u8>>

Read the full contents of a file.

Source

fn is_executable(&self, path: &Path) -> Result<bool>

Check whether a file has the executable bit set.

Source

fn is_ignored(&self, path: &Path, is_dir: bool) -> bool

Check whether a path is ignored by follow_rules (gitignore-style).

Source

fn mtime_ms(&self, path: &Path) -> Result<Option<u64>>

Return the file’s modification time as milliseconds since the Unix epoch.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§