Skip to main content

FileSystem

Trait FileSystem 

Source
pub trait FileSystem:
    Send
    + Sync
    + Debug {
    // Required methods
    fn read_dir(&self, dir: &Path) -> Result<Vec<DirItem>>;
    fn metadata(&self, path: &Path) -> Result<Meta>;
    fn read(&self, path: &Path, limit: usize) -> Result<Vec<u8>>;

    // Provided methods
    fn can_create_dirs(&self) -> bool { ... }
    fn create_dir(&self, _path: &Path) -> Result<()> { ... }
    fn is_native(&self) -> bool { ... }
    fn is_dir(&self, path: &Path) -> bool { ... }
    fn is_file(&self, path: &Path) -> bool { ... }
}
Expand description

What the picker and the preview providers read from.

Required Methods§

Source

fn read_dir(&self, dir: &Path) -> Result<Vec<DirItem>>

A folder’s entries, in no particular order.

Source

fn metadata(&self, path: &Path) -> Result<Meta>

The facts of a path.

Source

fn read(&self, path: &Path, limit: usize) -> Result<Vec<u8>>

At most limit bytes from the start of a file.

Provided Methods§

Source

fn can_create_dirs(&self) -> bool

Whether it can make folders (FileSystem::create_dir): the picker’s New folder is disabled, with the reason, when it cannot.

Source

fn create_dir(&self, _path: &Path) -> Result<()>

Makes a folder, whose parent exists. By default it cannot.

Source

fn is_native(&self) -> bool

Whether its paths are the system’s own, so that other programs (a system thumbnailer) can open them.

Source

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

Source

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

Implementors§