fix(fs): make FileSystems Clone and Debug
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
595a376a62
commit
a84248eca3
4 changed files with 4 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "kxio"
|
name = "kxio"
|
||||||
version = "1.1.1"
|
version = "1.1.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Paul Campbell <pcampbell@kemitix.net>"]
|
authors = ["Paul Campbell <pcampbell@kemitix.net>"]
|
||||||
description = "Provides injectable Filesystem and Network resources to make code more testable"
|
description = "Provides injectable Filesystem and Network resources to make code more testable"
|
||||||
|
|
|
@ -30,6 +30,7 @@ pub fn temp() -> Result<FileSystem> {
|
||||||
temp::new().map(FileSystem::Temp)
|
temp::new().map(FileSystem::Temp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub enum FileSystem {
|
pub enum FileSystem {
|
||||||
Real(real::RealFileSystem),
|
Real(real::RealFileSystem),
|
||||||
Temp(temp::TempFileSystem),
|
Temp(temp::TempFileSystem),
|
||||||
|
|
|
@ -4,6 +4,7 @@ pub const fn new(base: PathBuf) -> RealFileSystem {
|
||||||
RealFileSystem { base }
|
RealFileSystem { base }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct RealFileSystem {
|
pub struct RealFileSystem {
|
||||||
base: PathBuf,
|
base: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ pub(super) fn new() -> super::Result<TempFileSystem> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
pub struct TempFileSystem {
|
pub struct TempFileSystem {
|
||||||
real: super::real::RealFileSystem,
|
real: super::real::RealFileSystem,
|
||||||
_temp_dir: Arc<Mutex<TempDir>>,
|
_temp_dir: Arc<Mutex<TempDir>>,
|
||||||
|
|
Loading…
Reference in a new issue