directiva 0.2.0

A tiny, paste-friendly directive mini-language: ACTION:[<KIND>]NAME[@PATH][=NOTE]
Documentation
//! The [`Target`] trait — the domain object a directive is matched against.
//!
//! Matching is *pushed into the target* rather than pulled out as data: the target decides which of
//! its names/scopes a [`Pattern`] is tested over. That keeps matching allocation-free and lets the
//! caller define alias semantics (e.g. a cross-name cluster `Foo.bar/Baz.bar` can test each alias
//! *and* the joined form) without the crate hardcoding any join convention.

use crate::core::glob::Pattern;

/// A thing a [`Directive`](crate::core::Directive) can select.
pub trait Target {
    /// The target's category, compared **exactly** against a directive's `<KIND>`. The default
    /// `None` means "no category", so any `<KIND>` directive will *not* match — override when your
    /// targets are categorized.
    fn qualifier(&self) -> Option<&str> {
        None
    }

    /// Does `pat` match (any of) this target's names? Required — NAME is the one mandatory field.
    fn matches_name(&self, pat: &Pattern) -> bool;

    /// Does `pat` match (any of) this target's scopes (e.g. file paths)? The default `false` means
    /// "no scope", so a directive carrying an `@PATH` filter will *not* match — override when your
    /// targets are locatable.
    fn matches_scope(&self, pat: &Pattern) -> bool {
        let _ = pat;
        false
    }
}