cargo::core

Module gc

Source
Expand description

Support for garbage collecting unused files from downloaded files or artifacts from the target directory.

The Gc type provides the high-level interface for the garbage-collection system.

Garbage collection can be done β€œautomatically” by cargo, which it does by default once a day when running any command that does a lot of work (like cargo build). The entry point for this is the auto_gc function, which handles some basic setup, creating the Gc, and calling Gc::auto.

Garbage collection can also be done manually via the cargo clean command by passing any option that requests deleting unused files. That is implemented by calling the Gc::gc method.

Garbage collection for the global cache is guided by the last-use tracking implemented in the crate::core::global_cache_tracker module. See that module documentation for an in-depth explanation of how global cache tracking works.

Structs§

  • AutoConfig πŸ”’
    Automatic garbage collection settings from the gc.auto config table.
  • Garbage collector.
  • Options to use for garbage collection.

Constants§

Functions§