pub enum BinaryOperator {
Show 16 variants
And,
Or,
Equal,
NotEqual,
LowerThan,
LowerOrEqualThan,
GreaterThan,
GreaterOrEqualThan,
Plus,
Minus,
Asterisk,
Slash,
DoubleSlash,
Percent,
Caret,
Concat,
}
Expand description
Represents binary operators used in a binary expression.
Variants§
And
Logical AND operator (and
)
Or
Logical OR operator (or
)
Equal
Equality operator (==
)
NotEqual
Inequality operator (~=
)
LowerThan
Less than operator (<
)
LowerOrEqualThan
Less than or equal operator (<=
)
GreaterThan
Greater than operator (>
)
GreaterOrEqualThan
Greater than or equal operator (>=
)
Plus
Addition operator (+
)
Minus
Subtraction operator (-
)
Asterisk
Multiplication operator (*
)
Slash
Division operator (/
)
DoubleSlash
Integer division operator (//
)
Percent
Modulo operator (%
)
Caret
Exponentiation operator (^
)
Concat
String concatenation operator (..
)
Implementations§
Source§impl BinaryOperator
impl BinaryOperator
Sourcepub fn precedes(&self, other: Self) -> bool
pub fn precedes(&self, other: Self) -> bool
Checks if this operator has higher precedence than another operator.
Sourcepub fn precedes_unary_expression(&self) -> bool
pub fn precedes_unary_expression(&self) -> bool
Checks if this operator has higher precedence than unary expressions.
Currently only the exponentiation operator (^
) has this property.
Sourcepub fn is_left_associative(&self) -> bool
pub fn is_left_associative(&self) -> bool
Determines if this operator is left associative.
Left associative operators like +
evaluate expressions from left to right:
a + b + c
is evaluated as (a + b) + c
.
Sourcepub fn is_right_associative(&self) -> bool
pub fn is_right_associative(&self) -> bool
Determines if this operator is right associative.
Right associative operators like ^
evaluate expressions from right to left:
a ^ b ^ c
is evaluated as a ^ (b ^ c)
.
Sourcepub fn left_needs_parentheses(&self, left: &Expression) -> bool
pub fn left_needs_parentheses(&self, left: &Expression) -> bool
Determines if the left operand needs parentheses when generating code.
Sourcepub fn right_needs_parentheses(&self, right: &Expression) -> bool
pub fn right_needs_parentheses(&self, right: &Expression) -> bool
Determines if the right operand needs parentheses when generating code.
Trait Implementations§
Source§impl Clone for BinaryOperator
impl Clone for BinaryOperator
Source§fn clone(&self) -> BinaryOperator
fn clone(&self) -> BinaryOperator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BinaryOperator
impl Debug for BinaryOperator
Source§impl PartialEq for BinaryOperator
impl PartialEq for BinaryOperator
impl Copy for BinaryOperator
impl Eq for BinaryOperator
impl StructuralPartialEq for BinaryOperator
Auto Trait Implementations§
impl Freeze for BinaryOperator
impl RefUnwindSafe for BinaryOperator
impl Send for BinaryOperator
impl Sync for BinaryOperator
impl Unpin for BinaryOperator
impl UnwindSafe for BinaryOperator
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
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
key
and return true
if they are equal.Source§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
Source§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
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>
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>
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