pub enum BindingPower {
Show 13 variants
Base,
Or,
And,
Equality,
Relation,
AddSub,
MulDiv,
Power,
Nullish,
Prefix,
Range,
Call,
Prime,
}Expand description
An enum which defines how strong a operator binds it’s operands.
If a binding power is higher the operator is more likely to directly operate on it’s neighbours.
Variants§
Implementations§
Source§impl BindingPower
impl BindingPower
Sourcepub fn for_binary_operator(op: &BinaryOperator) -> Self
pub fn for_binary_operator(op: &BinaryOperator) -> Self
Returns the binding power of this operator.
Note that there are some variants here which can have multiple meanings.
Operator::Equal can be assignment but can also be equality.
Operator::Add can be the add operator but also the plus prefix
operator which have different binding powers.
This function returns the binding power for if the operator is used in the infix position.
pub fn for_postfix_operator(op: &PostfixOperator) -> Self
pub fn for_prefix_operator(op: &PrefixOperator) -> Self
Sourcepub fn for_expr(expr: &Expr) -> BindingPower
pub fn for_expr(expr: &Expr) -> BindingPower
Returns the binding power for this expression. This is generally
BindingPower::Prime as most value variants are prime expressions,
however some like Value::Expression and Value::Range have a different
binding power.
Trait Implementations§
Source§impl Clone for BindingPower
impl Clone for BindingPower
Source§fn clone(&self) -> BindingPower
fn clone(&self) -> BindingPower
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BindingPower
impl Debug for BindingPower
Source§impl Ord for BindingPower
impl Ord for BindingPower
Source§fn cmp(&self, other: &BindingPower) -> Ordering
fn cmp(&self, other: &BindingPower) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for BindingPower
impl PartialEq for BindingPower
Source§impl PartialOrd for BindingPower
impl PartialOrd for BindingPower
impl Copy for BindingPower
impl Eq for BindingPower
impl StructuralPartialEq for BindingPower
Auto Trait Implementations§
impl Freeze for BindingPower
impl RefUnwindSafe for BindingPower
impl Send for BindingPower
impl Sync for BindingPower
impl Unpin for BindingPower
impl UnsafeUnpin for BindingPower
impl UnwindSafe for BindingPower
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> Comparable<K> for Q
impl<Q, K> Comparable<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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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