pub struct TempDir(/* private fields */);Expand description
A temporary directory.
A temporary directory, generated with tempfile crate.
Methods from Deref<Target = TempDir>§
Sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
Accesses the Path to the temporary directory.
§Examples
use tempfile::TempDir;
let tmp_path;
{
let tmp_dir = TempDir::new()?;
tmp_path = tmp_dir.path().to_owned();
// Check that the temp directory actually exists.
assert!(tmp_path.exists());
// End of `tmp_dir` scope, directory will be deleted
}
// Temp directory should be deleted by now
assert_eq!(tmp_path.exists(), false);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