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§
type Args: Iterator<Item = String>
type File: File
type Stdout: Write
type Metadata: Metadata
type DirEntry: DirEntry
type Instant: Sub<Output = Duration> + Clone
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>>
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.