All notable changes to this project will be documented in this file. This project uses Semantic Versioning.
0.8.0 - 2026-06-03
- #11:
Added
TempFile::builder()andTempDir::builder()for configuring the name prefix, suffix and target directory before creation. - #12:
Added
keepto disable automatic deletion andpersistto move a temporary file or directory to a permanent location. On failurepersistleaves the temporary intact and reports its path viaPersistError(see below). - #1:
drop_asyncnow removes the file or directory viatokio::fsdirectly when it is the sole owner, rather than offloading a synchronous drop to a blocking thread. The synchronousDropremains an always-armed backstop. - #15:
Added
closetoTempFileandTempDir: a synchronous, error-observable deletion returningio::Result<()>, complementingdrop_async. On a deletion error it disarms automatic cleanup and leaves the file or directory in place for the caller to handle.
- The crate now declares
#![forbid(unsafe_code)]. The previousManuallyDrop/unsafedrop machinery was replaced by safe code that relies on struct field drop order to close the file handle before the file is deleted. persistnow returns aPersistErroron failure that carries the path of the still-intact temporary, so a failed move (for example cross-device) no longer deletes the data. The local handle is closed before the rename so the move also succeeds on Windows.- Automatically generated temporary names are now unpredictable (seeded from the
OS RNG via
RandomState, with a per-process counter for guaranteed local uniqueness) and created with an exclusive (O_EXCL) create, closing a predictable-name / preexisting-file race. User-supplied names keep their previous create-or-open behavior. - #14:
A name
prefixorsuffixcontaining a path separator is now rejected with the newError::InvalidAffix, so a composed name can no longer escape the target directory via../traversal or an absolute-path replacement. - Bumped the crate to Rust edition 2024 with a declared MSRV of 1.85.
- #16: Raised test coverage from ~67% to ~94%.
0.7.0 - 2025-02-22
- Added the
drop_asyncfunctions to provide controlled andasyncdropping.
0.6.0 - 2024-06-30
- #7:
Added
TempDirfor automatically deleted temporary directories.
- Refactored temporary file name generation.
- Run tests on Linux, MacOS and Windows.
- Changed function signatures to take
Borrow<Path>instead ofPathBuf.
0.5.0 - 2023-12-06
- The
newandnew_infunctions now do not rely on theuuidfeature anymore for the generation of temporary file names. - The
uuidfeature is now not enabled by default anymore.
- Some unnecessary heap allocations were removed.
0.4.0 - 2023-06-16
- Added
uuidas a default crate feature and feature gated alluuidcrate related functionality. - Added the
new_with_nameandnew_with_name_inmethods to use a provided file name. - Added the
new_with_uuidandnew_with_uuid_inmethods to use a provided UUID as the file suffix. - The library now explicitly declares
allow(unsafe_code).
- Added the
open_romethod to create a new clone in read-only mode.
- Added the functionality to create both borrowed and owned
TempFileinstances from an existing file. Previously, only borrowed instances were possible this way. - The
TempFilemethods are now returning a crate specific error type.
- 🎉 Initial release.