feat(fs): add TempFileSystem::as_real()
All checks were successful
Rust / build (map[name:nightly]) (push) Successful in 5m36s
Rust / build (map[name:stable]) (push) Successful in 5m59s
Release Please / Release-plz (push) Successful in 2m37s

This commit is contained in:
Paul Campbell 2024-11-17 19:20:55 +00:00
parent d58ec0eba2
commit e25531df61
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::*;