[−][src]Struct vmm_sys_util::tempdir::TempDir
Wrapper over a temporary directory.
The directory will be maintained for the lifetime of the TempDir
object.
Implementations
impl TempDir
[src]
pub fn new_with_prefix<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_with_prefix("/tmp/testdir").unwrap();
pub fn new_in(path: &Path) -> Result<TempDir>
[src]
Creates a new temporary directory with inside path
.
The directory will be removed when the object goes out of scope.
Examples
let t = TempDir::new_in(Path::new("/tmp/")).unwrap();
pub fn new() -> Result<TempDir>
[src]
Creates a new temporary directory with inside $TMPDIR
if set, otherwise in /tmp
.
The directory will be removed when the object goes out of scope.
Examples
let t = TempDir::new().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_with_prefix("/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_with_prefix("/tmp/testdir").unwrap(); assert!(temp_dir.as_path().exists());
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,