[][src]Crate auto_delete_path

A super small crate which contains AutoDeletePath, a path which gets automatically deleted when it goes out of scope.

Examples

{
    let tmp_path = auto_delete_path::AutoDeletePath::temp(); // creates a new path at the default temp folder
    std::fs::create_dir(&tmp_path); // AutoDeletePath implements AsRef<Path>
    let subfile = tmp_path.as_ref().join("subfile"); // create a subfile
    std::fs::File::create(&subfile).unwrap();
} // tmp_path dies here, so the directory and its contents will be deleted

See AutoDeletePath and include_to_auto_delete_path for more examples.

Macros

include_to_auto_delete_path

Macro for including a source file, and writing it to a new AutoDeletePath::temp.

Structs

AutoDeletePath

This struct simply holds an instance of std::path::PathBuf. However, when such an instance goes out of scope and is destroyed, its destructor will be called, which attempts to delete the owned path (either file or directory).