[−][src]Struct vmm_sys_util::tempdir::TempDir
Wrapper over a temporary directory.
The directory will be maintained for the lifetime of the TempDir object.
Methods
impl TempDir[src]
pub fn new<P: AsRef<OsStr>>(prefix: P) -> Result<TempDir>[src]
Creates a new temporary directory with prefix.
The directory will be removed when the object goes out of scope.
Examples
let t = TempDir::new("/tmp/testdir").unwrap();
pub fn remove(&self) -> Result<()>[src]
Removes the temporary directory.
Calling this is optional as when a TempDir object goes out of scope,
the directory will be removed.
Calling remove explicitly allows for better error handling.
Errors
This function can only be called once per object. An error is returned otherwise.
Examples
let temp_dir = TempDir::new("/tmp/testdir").unwrap(); temp_dir.remove().unwrap();
pub fn as_path(&self) -> &Path[src]
Returns the path to the tempdir.
Examples
let temp_dir = TempDir::new("/tmp/testdir").unwrap(); assert!(temp_dir.as_path().exists());
Trait Implementations
Auto Trait Implementations
impl Send for TempDir
impl Sync for TempDir
impl Unpin for TempDir
impl UnwindSafe for TempDir
impl RefUnwindSafe for TempDir
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,