pub struct TempDir { /* private fields */ }
Expand description
A temporary directory
Implementations§
source§impl TempDir
impl TempDir
sourcepub fn new(prefix: &str) -> Result<TempDir>
pub fn new(prefix: &str) -> Result<TempDir>
Creates a new temporary directory with the given prefix
Errors
Any of the following will produce errors:
- An OS temporary directory that contain non-UTF-8 characters
- Failure to parse a CString from the given data
mkdtemp
returning NULL
Examples
use std::fs;
use mktemp::TempDir;
let td = TempDir::new("my-groovy-tempdir-").unwrap();
assert!(fs::metadata(td.path()).is_ok());