Docs.rs
  • git-tempfile-3.0.3
    • git-tempfile 3.0.3
    • Permalink
    • Docs.rs crate page
    • MIT/Apache-2.0
    • Links
    • Repository
    • crates.io
    • Source
    • Owners
    • Byron
    • Dependencies
      • dashmap ^5.1.0 normal
      • once_cell ^1.8.0 normal
      • signal-hook ^0.3.9 normal
      • signal-hook-registry ^1.4.0 normal
      • tempfile ^3.2.0 normal
      • libc ^0.2.98 normal
    • Versions
    • 100% of the crate is documented
  • Platform
    • i686-pc-windows-msvc
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate git_tempfile

git_tempfile3.0.3

  • All Items

Sections

  • Initial Setup
  • Limitations
    • Tempfiles might remain on disk

Crate Items

  • Modules
  • Structs
  • Enums
  • Functions

Crates

  • git_tempfile

Crate git_tempfile

Source
Expand description

git-style registered tempfiles that are removed upon typical termination signals.

To register signal handlers in a typical application that doesn’t have its own, call git_tempfile::setup(Default::default()) before creating the first tempfile.

Signal handlers are powered by [signal-hook] to get notified when the application is told to shut down to assure tempfiles are deleted. The deletion is filtered by process id to allow forks to have their own set of tempfiles that won’t get deleted when the parent process exits.

§Initial Setup

As no handlers for TERMination are installed, it is required to call setup() before creating the first tempfile. This also allows to control how git-tempfiles integrates with other handlers under application control.

As a general rule of thumb, use Default::default() as argument to emulate the default behaviour and abort the process after cleaning temporary files. Read more about options in SignalHandlerMode.

§Limitations

§Tempfiles might remain on disk

  • Uninterruptible signals are received like SIGKILL
  • The application is performing a write operation on the tempfile when a signal arrives, preventing this tempfile to be removed, but not others. Any other operation dealing with the tempfile suffers from the same issue.

Modules§

create_dir
handle
handler
remove_dir

Structs§

Handle
A registered temporary file which will delete itself on drop or if the program is receiving signals that should cause it to terminate.

Enums§

AutoRemove
A type expressing the ways we cleanup after ourselves to remove resources we created. Note that cleanup has no effect if the tempfile is persisted.
ContainingDirectory
A type expressing the ways we can deal with directories containing a tempfile.
SignalHandlerMode
Define how our signal handlers act

Functions§

mark_at
A shortcut to Handle::<Closed>::at() providing a closed temporary file to mark the presence of something.
new
A shortcut to Handle::<Writable>::new(), creating a writable temporary file with non-clashing name in a directory.
setup
Initialize signal handlers and other state to keep track of tempfiles, and must be called before the first tempfile is created, allowing to set the mode in which signal handlers are installed.
writable_at
A shortcut to Handle::<Writable>::at() providing a writable temporary file at the given path.

Results

Settings
Help

Type "at_path" not found. Showing results for closest type name "path" instead.

No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.
    method
    git_tempfile::create_dir::Iter::new
    &Path -> Iter
    Create a new instance that creates target when iterated …
    method
    git_tempfile::create_dir::Iter::new_with_retries
    &Path, Retries -> Iter
    Create a new instance that creates target when iterated …
    function
    git_tempfile::create_dir::all
    &Path, Retries -> Result<&Path>
    Create all directories leading to dir including dir itself …
    method
    git_tempfile::remove_dir::Iter::new
    &Path, &Path -> Result<Iter>
    Create a new instance that deletes target but will stop at …
    function
    git_tempfile::remove_dir::empty_upward_until_boundary
    &Path, &Path -> Result<&Path>
    Delete all empty directories from delete_dir upward and …
    function
    git_tempfile::create_dir::all
    &Path, Retries -> Result<&Path>
    Create all directories leading to dir including dir itself …
    function
    git_tempfile::remove_dir::empty_upward_until_boundary
    &Path, &Path -> Result<&Path>
    Delete all empty directories from delete_dir upward and …