pub struct Operator {
pub kind: OperatorKind,
pub lhs: BExpression,
pub rhs: BExpression,
pub matching: Option<Matching>,
pub span: Option<Span>,
}
Expand description
A binary operator expression with left- and right-hand sides.
Operator expressions may optionally have a matching clause for more specific vector matching behavior.
Note that operator precedence is accounted for at parse-time, so the resulting tree (i.e. lhs/rhs expressions) should already account for un-grouped expressions at the same syntax level.
Fields§
§kind: OperatorKind
This Operator’s function (multiply, divide, power, equals, etc)
lhs: BExpression
The left-hand-side expression
rhs: BExpression
The right-hand-side expression
matching: Option<Matching>
An optional matching clause for this operator (on(...)
, ignoring(...)
)
span: Option<Span>
Implementations§
Source§impl Operator
impl Operator
pub fn new(kind: OperatorKind, lhs: Expression, rhs: Expression) -> Self
Sourcepub fn matching(self, matching: Matching) -> Self
pub fn matching(self, matching: Matching) -> Self
Sets or replaces this Operator’s Matching clause
Sourcepub fn clear_matching(self) -> Self
pub fn clear_matching(self) -> Self
Clears this Operator’s Matching clause, if any
pub fn span<S: Into<Span>>(self, span: S) -> Self
Sourcepub fn wrap(self) -> Expression
pub fn wrap(self) -> Expression
Wraps this Operator in an Expression
pub fn return_value(&self) -> ReturnValue
Trait Implementations§
impl StructuralPartialEq for Operator
Auto Trait Implementations§
impl Freeze for Operator
impl RefUnwindSafe for Operator
impl Send for Operator
impl Sync for Operator
impl Unpin for Operator
impl UnwindSafe for Operator
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