pub(crate) mod platform_env;
use crate::Env;
use crate::Fs;
use crate::env::EnvImpl;
use crate::fs::FsImpl;
use platform_env::PlatformEnv;
pub trait Platform {
type E: Env;
type F: Fs + platform_env::CurrentDirSetter;
fn env(&self) -> &(impl Env + use<Self>);
fn env_mut(&mut self) -> PlatformEnv<'_, Self::E, Self::F>;
fn fs(&self) -> &(impl Fs + use<Self>);
fn fs_mut(&mut self) -> &mut (impl Fs + use<Self>);
}
pub(crate) struct PlatformImpl {
pub(crate) env: EnvImpl,
pub(crate) fs: FsImpl,
}
impl Platform for PlatformImpl {
type E = EnvImpl;
type F = FsImpl;
fn env(&self) -> &(impl Env + use<>) {
&self.env
}
fn env_mut(&mut self) -> PlatformEnv<'_, Self::E, Self::F> {
PlatformEnv {
env: &mut self.env,
fs: &mut self.fs,
}
}
fn fs(&self) -> &(impl Fs + use<>) {
&self.fs
}
fn fs_mut(&mut self) -> &mut (impl Fs + use<>) {
&mut self.fs
}
}