pub struct TempDir { /* private fields */ }
Expand description
A temporary directory
Implementations
sourceimpl 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 RefUnwindSafe for TempDir
impl Send for TempDir
impl Sync for TempDir
impl Unpin for TempDir
impl UnwindSafe for TempDir
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more