Trait Io

Source
pub trait Io: Sized {
    type Args: Iterator<Item = String>;
    type File: File;
    type Stdout: Write;
    type Metadata: Metadata;
    type DirEntry: DirEntry;
    type Instant: Sub<Output = Duration> + Clone;

Show 16 methods // Required methods fn args(&self) -> Self::Args; fn stdout(&self) -> Self::Stdout; fn metadata(&self, path: &str) -> Result<Self::Metadata>; fn create_dir(&self, path: &str) -> Result<()>; fn create(&self, path: &str) -> Result<Self::File>; fn open(&self, path: &str) -> Result<Self::File>; fn now(&self) -> Self::Instant; fn read_dir(&self, path: &str) -> Result<Vec<Self::DirEntry>>; fn current_dir(&self) -> Result<String>; fn set_current_dir(&self, path: &str) -> Result<()>; // Provided methods fn read(&self, path: &str) -> Result<Vec<u8>> { ... } fn read_to_string(&self, path: &str) -> Result<String> { ... } fn write(&self, path: &str, data: &[u8]) -> Result<()> { ... } fn create_dir_recursively(&self, path: &str) -> Result<()> { ... } fn write_recursively(&self, path: &str, data: &[u8]) -> Result<()> { ... } fn read_dir_type( &self, path: &str, is_dir: bool, ) -> Result<Vec<Self::DirEntry>> { ... }
}

Required Associated Types§

Required Methods§

Source

fn args(&self) -> Self::Args

Source

fn stdout(&self) -> Self::Stdout

Source

fn metadata(&self, path: &str) -> Result<Self::Metadata>

Source

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

Source

fn create(&self, path: &str) -> Result<Self::File>

Source

fn open(&self, path: &str) -> Result<Self::File>

Source

fn now(&self) -> Self::Instant

Source

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

Source

fn current_dir(&self) -> Result<String>

Source

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

Provided Methods§

Source

fn read(&self, path: &str) -> Result<Vec<u8>>

Source

fn read_to_string(&self, path: &str) -> Result<String>

Source

fn write(&self, path: &str, data: &[u8]) -> Result<()>

Source

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

Source

fn write_recursively(&self, path: &str, data: &[u8]) -> Result<()>

Source

fn read_dir_type(&self, path: &str, is_dir: bool) -> Result<Vec<Self::DirEntry>>

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§