Struct rets_expression::OpNode
source · #[non_exhaustive]pub struct OpNode {
pub left: Box<Expression>,
pub op: ExpressionOp,
pub right: Box<Expression>,
/* private fields */
}Expand description
A node representing a binary operation
E.g. A + B
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.left: Box<Expression>The expression on the left of the operation
op: ExpressionOpThe operation to perform
right: Box<Expression>The expression on the left of the operation
Implementations§
source§impl OpNode
impl OpNode
sourcepub fn new(
left: impl Into<Box<Expression>>,
op: ExpressionOp,
right: impl Into<Box<Expression>>
) -> Self
pub fn new( left: impl Into<Box<Expression>>, op: ExpressionOp, right: impl Into<Box<Expression>> ) -> Self
Create a new node
sourcepub fn left(&self) -> &Expression
pub fn left(&self) -> &Expression
The expression on the left of the operation
sourcepub fn right(&self) -> &Expression
pub fn right(&self) -> &Expression
The expression on the left of the operation
sourcepub fn op(&self) -> &ExpressionOp
pub fn op(&self) -> &ExpressionOp
The operation being performed
source§impl OpNode
impl OpNode
sourcepub fn add(
left: impl Into<Box<Expression>>,
right: impl Into<Box<Expression>>
) -> OpNode
pub fn add( left: impl Into<Box<Expression>>, right: impl Into<Box<Expression>> ) -> OpNode
Create a new node
sourcepub fn sub(
left: impl Into<Box<Expression>>,
right: impl Into<Box<Expression>>
) -> OpNode
pub fn sub( left: impl Into<Box<Expression>>, right: impl Into<Box<Expression>> ) -> OpNode
Create a new node
sourcepub fn mul(
left: impl Into<Box<Expression>>,
right: impl Into<Box<Expression>>
) -> OpNode
pub fn mul( left: impl Into<Box<Expression>>, right: impl Into<Box<Expression>> ) -> OpNode
Create a new node
sourcepub fn div(
left: impl Into<Box<Expression>>,
right: impl Into<Box<Expression>>
) -> OpNode
pub fn div( left: impl Into<Box<Expression>>, right: impl Into<Box<Expression>> ) -> OpNode
Create a new node
sourcepub fn gt(
left: impl Into<Box<Expression>>,
right: impl Into<Box<Expression>>
) -> OpNode
pub fn gt( left: impl Into<Box<Expression>>, right: impl Into<Box<Expression>> ) -> OpNode
Create a new node
sourcepub fn gte(
left: impl Into<Box<Expression>>,
right: impl Into<Box<Expression>>
) -> OpNode
pub fn gte( left: impl Into<Box<Expression>>, right: impl Into<Box<Expression>> ) -> OpNode
Create a new node
sourcepub fn lt(
left: impl Into<Box<Expression>>,
right: impl Into<Box<Expression>>
) -> OpNode
pub fn lt( left: impl Into<Box<Expression>>, right: impl Into<Box<Expression>> ) -> OpNode
Create a new node
sourcepub fn lte(
left: impl Into<Box<Expression>>,
right: impl Into<Box<Expression>>
) -> OpNode
pub fn lte( left: impl Into<Box<Expression>>, right: impl Into<Box<Expression>> ) -> OpNode
Create a new node
sourcepub fn eq(
left: impl Into<Box<Expression>>,
right: impl Into<Box<Expression>>
) -> OpNode
pub fn eq( left: impl Into<Box<Expression>>, right: impl Into<Box<Expression>> ) -> OpNode
Create a new node
sourcepub fn ne(
left: impl Into<Box<Expression>>,
right: impl Into<Box<Expression>>
) -> OpNode
pub fn ne( left: impl Into<Box<Expression>>, right: impl Into<Box<Expression>> ) -> OpNode
Create a new node
Trait Implementations§
source§impl From<OpNode> for Expression
impl From<OpNode> for Expression
source§fn from(node: OpNode) -> Expression
fn from(node: OpNode) -> Expression
Converts to this type from the input type.
source§impl PartialEq<OpNode> for OpNode
impl PartialEq<OpNode> for OpNode
impl Eq for OpNode
impl StructuralEq for OpNode
impl StructuralPartialEq for OpNode
Auto Trait Implementations§
impl RefUnwindSafe for OpNode
impl Send for OpNode
impl Sync for OpNode
impl Unpin for OpNode
impl UnwindSafe for OpNode
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