drop-dir 0.1.0

A simple crate for self-dropping (RAII) directories.
Documentation
  • Coverage
  • 75%
    3 out of 4 items documented3 out of 3 items with examples
  • Size
  • Source code size: 5.71 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.23 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • webern/rs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • webern

drop-dir

A very simple crate for creating RAII directories.

Example

use std::path::PathBuf;
use drop_dir::DropDir;
use std::fs::File;

let drop_dir = DropDir::new(PathBuf::from("/tmp/some/path")).unwrap();
let mut file = File::create(drop_dir.path().join("file.txt")).unwrap();
// drop_dir deleted when it goes out of scope.

Limitation

In the example above, only the last component of the drop_dir is removed. That is, the dir /tmp/some/temp/path is deleted, but /tmp/some/temp remains. Any other behavior would get complicated.