pub struct OperatorInfo {
pub precedence: Precedence,
pub associativity: Associativity,
}Expand description
Operator information containing precedence and associativity.
This structure encapsulates the essential properties needed for operator precedence parsing, including the precedence level and how operators of the same precedence should be grouped.
Fields§
§precedence: PrecedenceThe precedence level of the operator (higher values have higher precedence)
associativity: AssociativityThe associativity of the operator (Left, Right, or None)
Implementations§
Source§impl OperatorInfo
impl OperatorInfo
Sourcepub fn new(precedence: Precedence, associativity: Associativity) -> Self
pub fn new(precedence: Precedence, associativity: Associativity) -> Self
Creates a new operator with the specified precedence and associativity.
§Arguments
precedence- The precedence level of the operator (higher values have higher precedence)associativity- The associativity of the operator (Left, Right, or None)
§Examples
let op = OperatorInfo::new(10, Associativity::Left);Sourcepub fn left(precedence: Precedence) -> Self
pub fn left(precedence: Precedence) -> Self
Sourcepub fn right(precedence: Precedence) -> Self
pub fn right(precedence: Precedence) -> Self
Sourcepub fn none(precedence: Precedence) -> Self
pub fn none(precedence: Precedence) -> Self
Trait Implementations§
Source§impl Clone for OperatorInfo
impl Clone for OperatorInfo
Source§fn clone(&self) -> OperatorInfo
fn clone(&self) -> OperatorInfo
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 OperatorInfo
impl RefUnwindSafe for OperatorInfo
impl Send for OperatorInfo
impl Sync for OperatorInfo
impl Unpin for OperatorInfo
impl UnwindSafe for OperatorInfo
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