17 lines
321 B
Rust
17 lines
321 B
Rust
|
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
|
||
|
}
|