1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Garbage collection for build artifacts and cargo cache.
//!
//! This module provides functionality to clean up old build artifacts from:
//! - Target directories (build artifacts)
//! - `~/.cargo/registry/cache` (downloaded crates)
//! - `~/.cargo/git/checkouts` (git dependencies)
//! - `~/.cargo/bin` (installed binaries)
//!
//! # Features
//!
//! - Size-based cleanup: Remove artifacts when directory exceeds size limit
//! - Age-based cleanup: Remove artifacts older than threshold
//! - Smart grouping: Removes all related artifacts together (by crate)
//! - Preservation rules: Always keeps important files and recent artifacts
//! - Parallel processing: Uses rayon for efficient directory scanning
//!
//! # Example
//!
//! ```no_run
//! use std::path::PathBuf;
//!
//! use cargo_hold::gc::config::Gc;
//!
//! let config = Gc::builder()
//! .target_dir("target")
//! .max_target_size(5 * 1024 * 1024 * 1024) // 5GB
//! .age_threshold_days(7)
//! .dry_run(false)
//! .debug(false)
//! .preserve_binary("cargo-hold")
//! .build();
//!
//! let stats = config.perform_gc(0)?;
//! println!("Freed {} bytes", stats.bytes_freed);
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
pub
pub use calculate_directory_size;
pub use ;