pub enum Expr {
Claim(String),
Not(Box<Expr>),
And(Vec<Expr>),
Or(Vec<Expr>),
}Expand description
A parsed requirement expression over claim names.
And and Or are n-ary: a chain of same-operator children is
kept flat in a single Vec<Expr> rather than nested left-folded
binary nodes. Construct via Expr::and / Expr::or /
Expr::not — those smart constructors splice same-operator
children so a and b and c parses to one And([a, b, c]) and
(a or b) or c parses to one Or([a, b, c]). The shape change
is invisible to evaluation (or and and are associative) but
makes diagnostic tree rendering one level shallower per same-op
chain.
Variants§
Claim(String)
Reference to a single claim by name.
Not(Box<Expr>)
Logical negation.
And(Vec<Expr>)
Logical conjunction over one-or-more children.
Or(Vec<Expr>)
Logical disjunction over one-or-more children.
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn and(parts: Vec<Expr>) -> Expr
pub fn and(parts: Vec<Expr>) -> Expr
Build an Expr::And from parts, splicing any child that
is itself an And so the result is a flat one-level chain.
A single-element vec collapses to its lone child unwrapped.
Empty vec is the identity (vacuously True); the parser
never produces this, but the constructor is defined for it.
Sourcepub fn or(parts: Vec<Expr>) -> Expr
pub fn or(parts: Vec<Expr>) -> Expr
Build an Expr::Or from parts, splicing any child that
is itself an Or so the result is a flat one-level chain.
A single-element vec collapses to its lone child unwrapped.
Empty vec is the identity (vacuously False); the parser
never produces this, but the constructor is defined for it.