pub struct TempDir { /* private fields */ }
Expand description
A temporary directory
Implementations§
Source§impl TempDir
impl TempDir
Sourcepub fn new(prefix: &str) -> Result<TempDir>
pub fn new(prefix: &str) -> Result<TempDir>
Creates a new temporary directory with the given prefix
§Errors
Any of the following will produce errors:
- Failure to parse a CString from the given data
mkdtemp
returning NULL
§Examples
use std::fs;
use mktemp::TempDir;
let td = TempDir::new("my-groovy-tempdir-").unwrap();
assert!(fs::metadata(td.path()).is_ok());
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