pub enum Arity {
Exact(usize),
Range {
min: usize,
max: usize,
},
AtLeast(usize),
}Expand description
How many operands an Op accepts.
Replaces a bare usize where 0 had to stand in for three unrelated
things — a genuine leaf, an optional operand, and “variadic, don’t check”.
Because verify skipped anything reporting 0, every variadic op opted
out of arity checking entirely, and the optional-operand case needed a
hand-written exception alongside the table.
Variants§
Exact(usize)
Exactly n operands.
Range
Between min and max operands, inclusive — an optional trailing
operand such as a seed.
AtLeast(usize)
n or more — genuinely variadic (Concat, While).
Implementations§
Source§impl Arity
impl Arity
Sourcepub fn min_operands(self) -> usize
pub fn min_operands(self) -> usize
The fewest operands this arity permits.
Sourcepub fn max_operands(self) -> Option<usize>
pub fn max_operands(self) -> Option<usize>
The most operands permitted, or None when unbounded.
Sourcepub fn is_unconstrained(self) -> bool
pub fn is_unconstrained(self) -> bool
Whether any operand count is permitted (AtLeast(0)), i.e. this arity
constrains nothing.
Trait Implementations§
impl Copy for Arity
impl Eq for Arity
impl StructuralPartialEq for Arity
Auto Trait Implementations§
impl Freeze for Arity
impl RefUnwindSafe for Arity
impl Send for Arity
impl Sync for Arity
impl Unpin for Arity
impl UnsafeUnpin for Arity
impl UnwindSafe for Arity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more