pub struct TempDir { /* private fields */ }
Expand description
Create and remove a temporary directory. The directory will be maintained for the lifetime of
the TempDir
object.
Implementations§
Source§impl TempDir
impl TempDir
Sourcepub fn new<P: AsRef<OsStr>>(prefix: P) -> Result<TempDir>
pub fn new<P: AsRef<OsStr>>(prefix: P) -> Result<TempDir>
Creates a new tempory directory. The directory will be removed when the object goes out of scope.
§Examples
let t = TempDir::new("/tmp/testdir").map_err(|_| ())?;
assert!(t.as_path().unwrap().exists());
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 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