Compare commits

..

2 commits

Author SHA1 Message Date
8d506131ca build(justfile): add validate dev branch recipe
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-04-28 11:29:44 +01:00
2e3827e0e0 feat(fs): new fs module to replace filesystem 2024-04-28 11:29:44 +01:00
2 changed files with 6 additions and 25 deletions

View file

@ -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(),
} }
} }
} }

View file

@ -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)
} }
} }