pub struct TempDir(/* private fields */);Expand description
A directory under the system temp directory, removed when this value is dropped — including while a panic unwinds.
let dir = TempDir::new("my-test");
std::fs::write(dir.join("key"), "secret").expect("writes");
let path = dir.path().to_path_buf();
drop(dir);
assert!(!path.exists());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TempDir
impl RefUnwindSafe for TempDir
impl Send for TempDir
impl Sync for TempDir
impl Unpin for TempDir
impl UnsafeUnpin for TempDir
impl UnwindSafe for TempDir
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more