[][src]Struct bdrck::testing::temp::Dir

pub struct Dir { /* fields omitted */ }

A directory within the system's standard temp directory that is automatically deleted when it goes out of scope. The directory is created on construction.

NOTE: For various reasons (e.g. races), temporary directories and files can be very dangerous to rely upon in production code. This struct, as well as File which is based upon it, are primarily intended to be used for unit testing only (thus their placement in the testing submodule).

Methods

impl Dir[src]

pub fn new(prefix: &str) -> Result<Dir>[src]

This is a shortcut version of new_in, which just creates the directory within the system's default temporary directory.

pub fn path(&self) -> &Path[src]

Return the path to this temporary directory.

pub fn sub_path<P: AsRef<Path>>(&self, path: P) -> Result<PathBuf>[src]

A convenience function which adds the given relative path to this temporary directory's absolute path.

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

"Close" this temporary directory, by deleting it along with all of its contents. This is called automatically by the Drop implementation, but it can also be called manually if you want to dispose of this instance without just letting it go out of scope.

Trait Implementations

impl Drop for Dir[src]

Auto Trait Implementations

impl RefUnwindSafe for Dir

impl Send for Dir

impl Sync for Dir

impl Unpin for Dir

impl UnwindSafe for Dir

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,