Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: Send + Sync {
    // Required methods
    fn id(&self) -> &'static str;
    fn name(&self) -> &'static str;
    fn supported_kinds(&self) -> &[ProjectKind];
    fn markers(&self) -> Vec<ProjectMarker>;
    fn detect(&self, path: &Path) -> Option<ProjectKind>;
    fn find_artifacts(&self, project_root: &Path) -> Result<Vec<Artifact>>;

    // Provided methods
    fn calculate_size(&self, artifact: &Artifact) -> Result<u64> { ... }
    fn pre_clean(&self, _artifact: &Artifact) -> Result<()> { ... }
    fn post_clean(&self, _artifact: &Artifact) -> Result<()> { ... }
    fn priority(&self) -> u8 { ... }
    fn cleanable_dirs(&self) -> &[&'static str] { ... }
}
Expand description

Trait that all language/framework plugins must implement

Required Methods§

Source

fn id(&self) -> &'static str

Unique identifier for this plugin

Source

fn name(&self) -> &'static str

Human-readable name

Source

fn supported_kinds(&self) -> &[ProjectKind]

Project kinds this plugin handles

Source

fn markers(&self) -> Vec<ProjectMarker>

Markers that identify projects this plugin handles

Source

fn detect(&self, path: &Path) -> Option<ProjectKind>

Detect if path is a project root for this plugin

Source

fn find_artifacts(&self, project_root: &Path) -> Result<Vec<Artifact>>

Find cleanable artifacts in a project directory

Provided Methods§

Source

fn calculate_size(&self, artifact: &Artifact) -> Result<u64>

Custom size calculation (override for special cases)

Source

fn pre_clean(&self, _artifact: &Artifact) -> Result<()>

Pre-clean hook (e.g., stop running processes)

Source

fn post_clean(&self, _artifact: &Artifact) -> Result<()>

Post-clean hook (e.g., update state files)

Source

fn priority(&self) -> u8

Priority when multiple plugins match (higher = preferred)

Source

fn cleanable_dirs(&self) -> &[&'static str]

Get cleanable directory names for fast scanning

Implementors§