Create temporary directory and file.
use maketemp::TempDir; use std::path::Path; fn main() { let p; { // create temporary directory. let dir = TempDir::open(); p = dir.path().to_string(); // true. println!("path {} exists: {} ",&p,Path::new(&p).exists()); // delete `dir` automatically here. } // false. println!("path: {} exists: {}",&p,Path::new(&p).exists()); }