modivo-utils-rs/crates/test-ext/src/lib.rs

17 lines
321 B
Rust
Raw Normal View History

2023-04-12 12:31:27 +02:00
use std::future::Future;
pub fn with_dir<F>(f: F)
where
F: Fn(tempdir::TempDir),
{
f(tempdir::TempDir::new_in("/tmp", "").unwrap())
}
pub async fn with_dir_async<F, FUT>(f: F)
where
FUT: Future<Output = ()>,
F: Fn(tempdir::TempDir) -> FUT,
{
f(tempdir::TempDir::new_in("/tmp", "").unwrap()).await
}