pub trait Io:
Send
+ Sync
+ 'static {
type File: FileExt;
type TempFile: FileExt;
type Rng: Rng;
// Required methods
fn create_dir_all(&self, path: &Path) -> Result<()>;
fn open(
&self,
create_new: bool,
read: bool,
write: bool,
path: &Path,
) -> Result<Self::File>;
fn tempfile(&self) -> Result<Self::TempFile>;
fn now(&self) -> DateTime<Utc>;
fn hard_link(&self, src: &Path, dst: &Path) -> Result<()>;
fn with_rng<F, R>(&self, f: F) -> R
where F: FnOnce(&mut Self::Rng) -> R;
fn remove_file_async(
&self,
path: &Path,
) -> impl Future<Output = Result<()>> + Send;
// Provided method
fn uuid(&self) -> Uuid { ... }
}
Required Associated Types§
Required Methods§
fn create_dir_all(&self, path: &Path) -> Result<()>
Sourcefn open(
&self,
create_new: bool,
read: bool,
write: bool,
path: &Path,
) -> Result<Self::File>
fn open( &self, create_new: bool, read: bool, write: bool, path: &Path, ) -> Result<Self::File>
TODO: when adding an async variant make sure all places where async is needed are replaced
fn tempfile(&self) -> Result<Self::TempFile>
fn now(&self) -> DateTime<Utc>
fn hard_link(&self, src: &Path, dst: &Path) -> Result<()>
fn with_rng<F, R>(&self, f: F) -> R
fn remove_file_async( &self, path: &Path, ) -> impl Future<Output = Result<()>> + Send
Provided Methods§
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.