Packages / rupm

temp-tools 0.1.0

Temporary directories and files with unique names that are deleted when dropped

Install

cargo add temp-tools --registry rupm

In Ruststudio: Packages, search for temp-tools, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-22.

Versions

README

# temp-tools

Temporary directories and files with unique names that are deleted when dropped

Add it with `rupm add temp-tools` (or `cargo add temp-tools --registry rupm`).

```rust
use temp_tools::{TempDir, TempFile};

let dir = TempDir::with_prefix("build")?;
std::fs::write(dir.join("a.txt"), "hello")?;
assert!(dir.path().is_dir());

let file = TempFile::with_contents(b"data")?;
assert_eq!(file.read_to_string()?, "data");

let path = dir.path().to_path_buf();
drop(dir);                // the directory and everything in it is removed
assert!(!path.exists());
```