pub type NonAssocExpr<Operand, Operator> = DelimitedVec<Operand, Operator, Forbidden, 1, 2>;Expand description
Type alias for non-associative binary operators.
Non-associative operators cannot be chained without parentheses. For example,
comparison operators in Rust: a == b == c is a syntax error, must be
(a == b) == c or a == (b == c).
This is a convenience alias for InfixExpr with default MAX=2, intended for
documenting non-associative operators in expression grammars.
§Examples
// Comparison operators are typically non-associative
type ComparisonExpr = NonAssocExpr<LiteralInteger, Equal>;
let mut tokens = "1 == 2".to_token_iter();
let expr: ComparisonExpr = tokens.parse().unwrap();
assert_eq!(expr.len(), 2);Aliased Type§
pub struct NonAssocExpr<Operand, Operator>(/* private fields */);