diskard_core/recognizer.rs
1use crate::error::Result;
2use crate::finding::{Category, Finding};
3
4/// A recognizer detects reclaimable disk space from a specific tool or ecosystem.
5///
6/// Recognizers come in two flavors:
7/// - **Path-based**: scan known fixed paths (caches, model stores)
8/// - **Project-based**: scan directories for marker files (build artifacts)
9pub trait Recognizer: Send + Sync {
10 /// Human-readable name (e.g., "Xcode DerivedData").
11 fn name(&self) -> &'static str;
12
13 /// Machine-readable identifier (e.g., "xcode-derived-data").
14 fn id(&self) -> &'static str;
15
16 /// Which category this recognizer belongs to.
17 fn category(&self) -> Category;
18
19 /// Scan for findings. Returns an empty vec if nothing found.
20 fn scan(&self) -> Result<Vec<Finding>>;
21}