Struct fencryption_lib::tmp::TmpDir

source ·
pub struct TmpDir(_);
Expand description

TmpDir is a struct to manipulate a temporary directory.

The “path” argument (in some methods) must be relative because it will be joined to the temporary directory path.

When this struct is dropped, the temporary directory itself 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 temporary directory. See fs::write.

Reads a file in the temporary directory. See fs::read.

Creates a directory inside the temporary directory. See fs::create_dir.

Creates a directory and all of its parent if they are missing (inside the temporary directory). See fs::create_dir_all.

Creates a file in the temporary directory. See File::create.

Opens a file in the temporary directory. See File::open.

Opens a file in the temporary directory using the provided OpenOptions. See fs::OpenOptions::open.

Gets metadata for the given path. Akin to fs::metadata.

Checks if a path exists in the current directory. Akin to Path::exists.

Reads temporary directory. Akin to fs::read_dir.

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.