Skip to main content

Module filter

Module filter 

Source
Expand description

Pattern-based file filtering for include/exclude operations

This module provides glob pattern matching for filtering files during copy, link, and remove operations.

§Pattern Syntax

  • * matches anything except /
  • ** matches anything including / (crosses directories)
  • ? matches a single character (except /)
  • [...] character classes
  • Leading / anchors to source root
  • Trailing / matches only directories

§Examples

use common::filter::{FilterSettings, FilterResult};
use std::path::Path;

let mut settings = FilterSettings::default();
settings.add_exclude("*.log").unwrap();
settings.add_exclude("target/").unwrap();

// .log files are excluded
assert!(matches!(
    settings.should_include(Path::new("debug.log"), false),
    FilterResult::ExcludedByPattern(_)
));

// other files are included
assert!(matches!(
    settings.should_include(Path::new("main.rs"), false),
    FilterResult::Included
));

Structs§

FilterPattern
A compiled filter pattern with metadata about its original form
FilterSettings
Settings for filtering files based on include/exclude patterns
TimeFilter
Time-based filter for matching entries by age (mtime/btime).

Enums§

FilterResult
Result of checking whether a path should be included
TimeFilterResult
Outcome of evaluating a TimeFilter against a metadata entry.
TimeSkipReason
Why an entry was skipped by a TimeFilter — the subset of TimeFilterResult that does not include Matched. Constructed via TimeFilterResult::as_skip_reason.

Functions§

reject_created_before_on_musl
Reject --created-before on musl builds, where birth time (btime) is unreadable via std::fs::Metadata::created() so every entry would fail evaluation and be skipped. No-op on glibc. tool names the binary for the error message.