Module vmm_sys_util::tempfile [−][src]
Struct for handling temporary files as well as any cleanup required.
The temporary files will be created with a name available as well as having
an exposed fs::File
for reading/writing.
The file will be removed when the object goes out of scope.
Examples
use std::env::temp_dir; use std::io::Write; use std::path::{Path, PathBuf}; use vmm_sys_util::tempfile::TempFile; let mut prefix = temp_dir(); prefix.push("tempfile"); let t = TempFile::new_with_prefix(prefix).unwrap(); let mut f = t.as_file(); f.write_all(b"hello world").unwrap(); f.sync_all().unwrap();
Structs
TempFile | Wrapper for working with temporary files. |