pub enum LabelExpr {
Label(SmallName),
Wildcard,
Dynamic {
expr: Box<Expr>,
quantifier: DynamicLabelQuantifier,
},
Not(Box<LabelExpr>),
And(Vec<LabelExpr>),
Or(Vec<LabelExpr>),
}Variants§
Implementations§
Source§impl LabelExpr
impl LabelExpr
Sourcepub fn is_static_conjunction(&self) -> bool
pub fn is_static_conjunction(&self) -> bool
Static conjunction: a single label or an And-chain of static labels.
Sourcepub fn is_static_disjunction(&self) -> bool
pub fn is_static_disjunction(&self) -> bool
Static disjunction: a single label or an Or-chain of static labels.
Sourcepub fn static_disjunction_arms(&self) -> Option<DisjunctionArms<'_>>
pub fn static_disjunction_arms(&self) -> Option<DisjunctionArms<'_>>
The per-arm borrowed views of a disjunction-bearing label
expression (LABS-1083): the two shapes the planner’s disjunction
fold and the parsed (p:A|B) produce. Or([A, B]) answers one
view — empty base, disjuncts [A, B] — each disjunct its own arm;
And([C, Or([A, B])]) (the pattern’s own conjunction carried
beside the folded Or) answers base [C], disjuncts [A, B] —
every arm the shared conjunction plus one disjunct. Every arm is a
static conjunction, and the union of the arms’ conjunctions is
equivalent to the expression, so a consumer that serves each arm’s
conjunction and unions the answers (deduplicated) serves the
expression. None for everything else: no disjunction (a plain
label or conjunction), a nested Or, an And of several Ors (a
DNF no producer builds), an empty Or, or any wildcard, dynamic,
or negated leaf. The arm-extraction twin of
is_static_conjunction:
conjunction consumers read a node’s retained labels, disjunction
consumers read this.
The views borrow: arm i is
DisjunctionArms::arms — the base’s names
plus one disjunct, iterated over the expression’s own names —
never a per-disjunct Vec clone of the shared conjunction (the
O(n·k) copies an owned per-arm answer would pay for an O(n+k)
expression).