pub struct TmpDir(_);
Expand description

TmpDir is a struct to manipulate a temporary directory.

The path argument in method that have it must be relative because it will be joined to the temporary directory path.

When this struct is dropped, the temporary directory is automatically deleted.

Implementations

Generates a new unique path in the temporary directory.

Writes to a file (or create it if it doesn’t exist) in the TmpDir. See std::fs::write.

Reads a file from the TmpDir. See std::fs::read.

Creates a directory. See std::fs::create_dir.

Creates a directory and all of its parent if they are missing. See std::fs::create_dir_all.

Creates a file in the TmpDir. See std::fs::File::create.

Opens a file from the TmpDir. See std::fs::File::open.

Opens a file from the TmpDir using the provided OpenOptions. See std::fs::OpenOptions::open.

Trait Implementations

Impl Drop trait so when the TmpDir is dropped, the directory is deleted.

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.