diskforge_core/rules/
mod.rs1pub mod android;
2pub mod app_uninstall;
3pub mod dev_artifacts;
4pub mod docker;
5pub mod known_paths;
6pub mod simulator;
7pub mod system_junk;
8pub mod user_rules;
9
10use crate::types::{Category, CleanableItem, Risk};
11use std::path::PathBuf;
12
13pub struct KnownPathRule {
15 pub path: PathBuf,
16 pub category: Category,
17 pub description: String,
18 pub risk: Risk,
19 pub regenerates: bool,
20 pub regeneration_hint: Option<String>,
21}
22
23impl KnownPathRule {
24 pub fn into_item(self, size: u64) -> CleanableItem {
25 let last_modified = crate::sizing::dir_last_modified(&self.path);
26 self.into_item_with_stats(size, last_modified)
27 }
28
29 pub fn into_item_with_stats(
30 self,
31 size: u64,
32 last_modified: Option<std::time::SystemTime>,
33 ) -> CleanableItem {
34 CleanableItem {
35 category: self.category,
36 path: self.path,
37 size,
38 risk: self.risk,
39 regenerates: self.regenerates,
40 regeneration_hint: self.regeneration_hint,
41 last_modified,
42 description: self.description,
43 cleanup_command: None,
44 }
45 }
46}