Skip to content

Latest commit

 

History

History
124 lines (84 loc) · 4.5 KB

File metadata and controls

124 lines (84 loc) · 4.5 KB

Changelog

All notable changes to this project will be documented in this file. This project uses Semantic Versioning.

0.8.0 - 2026-06-03

Added

  • #11: Added TempFile::builder() and TempDir::builder() for configuring the name prefix, suffix and target directory before creation.
  • #12: Added keep to disable automatic deletion and persist to move a temporary file or directory to a permanent location. On failure persist leaves the temporary intact and reports its path via PersistError (see below).
  • #1: drop_async now removes the file or directory via tokio::fs directly when it is the sole owner, rather than offloading a synchronous drop to a blocking thread. The synchronous Drop remains an always-armed backstop.
  • #15: Added close to TempFile and TempDir: a synchronous, error-observable deletion returning io::Result<()>, complementing drop_async. On a deletion error it disarms automatic cleanup and leaves the file or directory in place for the caller to handle.

Changed

  • The crate now declares #![forbid(unsafe_code)]. The previous ManuallyDrop / unsafe drop machinery was replaced by safe code that relies on struct field drop order to close the file handle before the file is deleted.
  • persist now returns a PersistError on 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 prefix or suffix containing a path separator is now rejected with the new Error::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.

Internal

  • #16: Raised test coverage from ~67% to ~94%.

0.7.0 - 2025-02-22

Added

  • Added the drop_async functions to provide controlled and async dropping.

0.6.0 - 2024-06-30

Added

  • #7: Added TempDir for automatically deleted temporary directories.

Internal

  • Refactored temporary file name generation.
  • Run tests on Linux, MacOS and Windows.

Changed

  • Changed function signatures to take Borrow<Path> instead of PathBuf.

0.5.0 - 2023-12-06

Changed

  • The new and new_in functions now do not rely on the uuid feature anymore for the generation of temporary file names.
  • The uuid feature is now not enabled by default anymore.

Internal

  • Some unnecessary heap allocations were removed.

0.4.0 - 2023-06-16

Added

  • Added uuid as a default crate feature and feature gated all uuid crate related functionality.
  • Added the new_with_name and new_with_name_in methods to use a provided file name.
  • Added the new_with_uuid and new_with_uuid_in methods to use a provided UUID as the file suffix.
  • The library now explicitly declares allow(unsafe_code).

0.3.0 - 2023-06-12

Added

  • Added the open_ro method to create a new clone in read-only mode.

0.2.0 - 2022-10-22

Added

  • Added the functionality to create both borrowed and owned TempFile instances from an existing file. Previously, only borrowed instances were possible this way.
  • The TempFile methods are now returning a crate specific error type.

0.1.0 - 2022-10-22

Internal

  • 🎉 Initial release.