pub struct Directive<A = String> {
pub action: A,
pub kind: Option<String>,
pub name: Pattern,
pub path: Option<Pattern>,
pub note: Option<String>,
}Expand description
One parsed directive: ACTION:[<KIND>]NAME[@PATH][=NOTE].
Generic over the action vocabulary A, defaulting to String. Matching (Directive::matches)
is independent of A.
Fields§
§action: AThe resolved action.
kind: Option<String>Optional KIND filter (<*>/omitted ⇒ None ⇒ any). Stored un-escaped; matched exactly.
name: PatternThe (required) NAME glob.
path: Option<Pattern>The optional @PATH glob.
note: Option<String>The optional =NOTE — free text, taken raw.
Implementations§
Source§impl<A> Directive<A>
impl<A> Directive<A>
Sourcepub fn matches(&self, t: &impl Target) -> bool
pub fn matches(&self, t: &impl Target) -> bool
Does this directive apply to t?
- KIND (if set) must equal
t.qualifier()exactly; - NAME must match (the target decides over which of its names, via
Target::matches_name); - PATH (if set) must match one of the target’s scopes (
Target::matches_scope).
Action-independent: a caller that wants to ignore some actions (e.g. a set config
directive) filters those out before matching.
Trait Implementations§
Source§impl<A: Display> Display for Directive<A>
Best-effort round-trip. Reproduces the canonical form; fields are emitted as stored, so a KIND
containing >/= won’t re-escape (KINDs in practice are plain identifiers).
impl<A: Display> Display for Directive<A>
Best-effort round-trip. Reproduces the canonical form; fields are emitted as stored, so a KIND
containing >/= won’t re-escape (KINDs in practice are plain identifiers).
impl<A: Eq> Eq for Directive<A>
Source§impl<A: PartialEq> PartialEq for Directive<A>
impl<A: PartialEq> PartialEq for Directive<A>
impl<A> StructuralPartialEq for Directive<A>
Auto Trait Implementations§
impl<A> Freeze for Directive<A>where
A: Freeze,
impl<A> RefUnwindSafe for Directive<A>where
A: RefUnwindSafe,
impl<A> Send for Directive<A>where
A: Send,
impl<A> Sync for Directive<A>where
A: Sync,
impl<A> Unpin for Directive<A>where
A: Unpin,
impl<A> UnsafeUnpin for Directive<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for Directive<A>where
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more