maketemp 0.1.0

Create temporary directory and files.
Documentation
  • Coverage
  • 100%
    9 out of 9 items documented1 out of 9 items with examples
  • Size
  • Source code size: 32.44 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 423.08 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • yokoyup/maketemp-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • yokoyup

Create temporary directory and file.

  • No dependencies.
  • Create in any directory.
  • Add prefix and suffix in the name.
  • Auto deletion.
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());
}