Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TempDir
✓ use tempfile::TempDir;
Creates a temporary directory and writes a file inside it.
use tempfile::TempDir;
use std::fs::File;
use std::io::Write;
fn main() -> std::io::Result<()> {
let dir = TempDir::new()?;
let file_path = dir.path().join("test.txt");
let mut file = File::create(&file_path)?;
writeln!(file, "Hello, world!")?;
println!("Created temp file: {:?}", file_path);
Ok(())
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
3.27.0latest on crates.io
Audit
Dependencies
No dependency data recorded yet.