[][src]Struct sys_util::TempDir

pub struct TempDir { /* fields omitted */ }

Create and remove 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 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());

pub fn remove(self) -> Result<()>[src]

Removes the temporary directory. Calling this is optional as dropping a TempDir object will also remove the directory. Calling remove explicitly allows for better error handling.

pub fn as_path(&self) -> Option<&Path>[src]

Returns the path to the tempdir if it is currently valid

Trait Implementations

impl Drop for TempDir[src]

Auto Trait Implementations

impl Send for TempDir

impl Sync for TempDir

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]