pub struct BinOperator {
pub kind: BinOpKind,
pub token: Token,
}Expand description
Represents a binary operator in the AST.
Fields§
§kind: BinOpKindThe specific kind of binary operator.
token: TokenThe token representing the binary operator in the source code.
Implementations§
Source§impl BinOperator
impl BinOperator
Sourcepub fn new(kind: BinOpKind, token: Token) -> BinOperator
pub fn new(kind: BinOpKind, token: Token) -> BinOperator
Sourcepub fn precedence(&self) -> u8
pub fn precedence(&self) -> u8
Returns the precedence of the operator.
Higher numbers indicate higher precedence.
§Returns
An unsigned 8-bit integer representing the operator’s precedence.
Sourcepub fn associativity(&self) -> BinOpAssociativity
pub fn associativity(&self) -> BinOpAssociativity
Returns the associativity of the operator.
Operators can be either left-associative or right-associative.
§Returns
A BinOpAssociativity enum indicating the associativity.
Trait Implementations§
Source§impl Clone for BinOperator
impl Clone for BinOperator
Source§fn clone(&self) -> BinOperator
fn clone(&self) -> BinOperator
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 moreAuto Trait Implementations§
impl Freeze for BinOperator
impl RefUnwindSafe for BinOperator
impl Send for BinOperator
impl Sync for BinOperator
impl Unpin for BinOperator
impl UnwindSafe for BinOperator
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