| Crates.io | with_dir |
| lib.rs | with_dir |
| version | 0.1.4 |
| created_at | 2023-03-15 11:55:18.003333+00 |
| updated_at | 2023-03-17 15:56:02.871133+00 |
| description | Scoped current working directory |
| homepage | |
| repository | https://github.com/huwper/with_dir |
| max_upload_size | |
| id | 810644 |
| size | 12,783 |
Blazingly fast utility library for temporarily changing the current working directory.
This library provides the following features:
The mutex allows this to be safely used across multhreaded tests, where each test will be entering different directories as no two WithDir instances can exist on different threads. However nested instances on the same thread can exist.
use with_dir::WithDir;
use std::path::Path;
let path = Path::new("src");
// enter that directory
WithDir::new(path).map(|_| {
// Current working directory is now src
}).unwrap();
// cwd is reset
Contributions welcome.
yes.
See LICENSE