Compare commits
2 commits
3fd546f632
...
8d506131ca
Author | SHA1 | Date | |
---|---|---|---|
8d506131ca | |||
2e3827e0e0 |
2 changed files with 6 additions and 25 deletions
|
@ -36,7 +36,7 @@ impl std::ops::Deref for FileSystem {
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
match self {
|
match self {
|
||||||
Self::Real(fs) => fs,
|
Self::Real(fs) => fs,
|
||||||
Self::Temp(fs) => fs,
|
Self::Temp(fs) => fs.deref(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
use std::{
|
use std::sync::{Arc, Mutex};
|
||||||
path::{Path, PathBuf},
|
|
||||||
sync::{Arc, Mutex},
|
|
||||||
};
|
|
||||||
|
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
||||||
|
@ -22,26 +19,10 @@ pub struct TempFileSystem {
|
||||||
_temp_dir: Arc<Mutex<TempDir>>,
|
_temp_dir: Arc<Mutex<TempDir>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl super::FileSystemLike for TempFileSystem {
|
impl std::ops::Deref for TempFileSystem {
|
||||||
fn base(&self) -> &Path {
|
type Target = dyn super::FileSystemLike;
|
||||||
self.real.base()
|
|
||||||
}
|
|
||||||
fn path_of(&self, path: PathBuf) -> super::Result<PathBuf> {
|
|
||||||
self.real.path_of(path)
|
|
||||||
}
|
|
||||||
fn file_write(&self, path: &Path, contents: &str) -> super::Result<()> {
|
|
||||||
self.real.file_write(path, contents)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn file_read_to_string(&self, path: &Path) -> super::Result<String> {
|
fn deref(&self) -> &Self::Target {
|
||||||
self.real.file_read_to_string(path)
|
&self.real
|
||||||
}
|
|
||||||
|
|
||||||
fn path_exists(&self, path: &Path) -> super::Result<bool> {
|
|
||||||
self.real.path_exists(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn path_is_file(&self, path: &Path) -> super::Result<bool> {
|
|
||||||
self.real.path_is_file(path)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue