[src]

Struct std::io::TempDir

pub struct TempDir {
    // some fields omitted
}

A wrapper for a path to temporary directory implementing automatic scope-based deletion.

Methods

impl TempDir

fn new_in(tmpdir: &Path, suffix: &str) -> Option<TempDir>

Attempts to make a temporary directory inside of tmpdir whose name will have the suffix suffix. The directory will be automatically deleted once the returned wrapper is destroyed.

If no directory can be created, None is returned.

fn new(suffix: &str) -> Option<TempDir>

Attempts to make a temporary directory inside of os::tmpdir() whose name will have the suffix suffix. The directory will be automatically deleted once the returned wrapper is destroyed.

If no directory can be created, None is returned.

fn unwrap(self) -> Path

Unwrap the wrapped std::path::Path from the TempDir wrapper. This discards the wrapper so that the automatic deletion of the temporary directory is prevented.

fn path<'a>(&'a self) -> &'a Path

Access the wrapped std::path::Path to the temporary directory.

Trait Implementations

impl Drop for TempDir

fn drop(&mut self)

The drop method, called when the value goes out of scope.