guardy 0.2.4

Fast, secure git hooks in Rust with secret scanning and protected file synchronization
Documentation
//! Filters for file and content processing
//!
//! This module provides a consistent interface for filtering files and content
//! during the scanning process. All filters implement the Filter trait for
//! composability and testability.

pub mod content;
pub mod directory;

use anyhow::Result;
use smallvec::SmallVec;

/// Common trait for all filters
pub trait Filter {
    /// Input type for the filter
    type Input: ?Sized;
    /// Output type for the filter
    type Output;

    /// Apply the filter to the input
    fn filter(&self, input: &Self::Input) -> Result<Self::Output>;

    /// Get the filter name for logging/debugging
    fn name(&self) -> &'static str;

    /// Get filter statistics for reporting
    fn get_stats(&self) -> SmallVec<[(String, String); 8]>;
}

/// Decision enum for directory-level filters
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FilterDecision {
    /// Process this file/directory
    Process,
    /// Skip this file/directory with reason
    Skip(&'static str),
}