Path

Trait Path 

Source
pub trait Path: PurePath {
    // Required methods
    fn exists(&self) -> bool;
    fn is_dir(&self) -> bool;
    fn is_file(&self) -> bool;
    fn read_dir(&self) -> Vec<Self>;
    fn read_file(&self) -> Vec<u8> ;
    fn write_file(&self, data: &[u8]);
}
Expand description

A path trait.

Required Methods§

Source

fn exists(&self) -> bool

Returns whether the path exists.

Source

fn is_dir(&self) -> bool

Returns whether the path is a directory.

Source

fn is_file(&self) -> bool

Returns whether the path is a file.

Source

fn read_dir(&self) -> Vec<Self>

Returns the directory entries.

Source

fn read_file(&self) -> Vec<u8>

Reads the file.

Source

fn write_file(&self, data: &[u8])

Writes the file.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§