feat(fs): add TempFileSystem::as_real()

This commit is contained in:
Paul Campbell 2024-11-17 19:20:55 +00:00
parent d52ab2df2e
commit d987da320b
2 changed files with 12 additions and 0 deletions

View file

@ -21,6 +21,11 @@ impl TempFileSystem {
_temp_dir: temp_dir, _temp_dir: temp_dir,
}) })
} }
/// Create a clone of the wrapped [FileSystem].
pub fn as_real(&self) -> FileSystem {
self.real.clone()
}
} }
impl std::ops::Deref for TempFileSystem { impl std::ops::Deref for TempFileSystem {
type Target = FileSystem; type Target = FileSystem;

View file

@ -9,6 +9,13 @@ mod path {
use super::*; use super::*;
#[test]
fn temp_as_real() {
let fs = fs::temp().expect("temp fs");
let read = fs.as_real();
assert_eq!(read.base(), fs.base());
}
mod is_link { mod is_link {
use super::*; use super::*;