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 {
|
||||
match self {
|
||||
Self::Real(fs) => fs,
|
||||
Self::Temp(fs) => fs,
|
||||
Self::Temp(fs) => fs.deref(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use tempfile::TempDir;
|
||||
|
||||
|
@ -22,26 +19,10 @@ pub struct TempFileSystem {
|
|||
_temp_dir: Arc<Mutex<TempDir>>,
|
||||
}
|
||||
|
||||
impl super::FileSystemLike for TempFileSystem {
|
||||
fn base(&self) -> &Path {
|
||||
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)
|
||||
}
|
||||
impl std::ops::Deref for TempFileSystem {
|
||||
type Target = dyn super::FileSystemLike;
|
||||
|
||||
fn file_read_to_string(&self, path: &Path) -> super::Result<String> {
|
||||
self.real.file_read_to_string(path)
|
||||
}
|
||||
|
||||
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)
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.real
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue