Skip to main content

euv_cli/dx/clean/
struct.rs

1use super::*;
2
3/// Execution options for `euv clean`.
4#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
5pub struct CleanOptions {
6    /// Project or workspace root directory to clean.
7    pub(crate) root_dir: PathBuf,
8    /// Whether to also execute `cargo clean` for the project target directory.
9    #[get(type(copy))]
10    pub(crate) all: bool,
11    /// When `true`, computes reclaimable bytes without removing files.
12    #[get(type(copy))]
13    pub(crate) dry_run: bool,
14}
15
16/// One cleaned (or planned) build artifact or cache directory entry.
17#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
18pub struct CleanEntry {
19    /// Filesystem path of the cleaned directory or entry.
20    pub(crate) path: String,
21    /// Logical cache category (`dist`, `mobile-hosts`, `icon-cache`, `ota-staging`, `cargo-target`).
22    pub(crate) category: String,
23    /// Reclaimed (or reclaimable) disk bytes.
24    #[get(type(copy))]
25    pub(crate) bytes_reclaimed: u64,
26    /// Whether the directory was actually deleted (`false` during `--dry-run`).
27    #[get(type(copy))]
28    pub(crate) removed: bool,
29}
30
31/// Structured summary report emitted by `euv clean`.
32#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
33pub struct CleanReport {
34    /// Cleaned project root directory path.
35    pub(crate) root_dir: String,
36    /// Whether `--dry-run` preview mode was active.
37    #[get(type(copy))]
38    pub(crate) dry_run: bool,
39    /// Individual cache entries processed.
40    pub(crate) entries: Vec<CleanEntry>,
41    /// Aggregate bytes reclaimed (or reclaimable).
42    #[get(type(copy))]
43    pub(crate) total_bytes_reclaimed: u64,
44    /// Whether `cargo clean` was executed (`--all` without `--dry-run`).
45    #[get(type(copy))]
46    pub(crate) cargo_clean_ran: bool,
47}