Expand description
The engine’s expression operators, one module per family.
Each family is its own file and its own type, so a caller can reach for exactly the set they mean and nothing here grows into one long list:
ArithmeticOperator,+ - * / % MOD ++ --AssignmentOperator,=and the compound formsBitwiseOperator,& | ^ ~ << >>and the word spellingsComparisonOperator,== != < > <= >=LogicalOperator,&& || !OtherOperator, grouping, indexing, separators, comments
Operator wraps all six when a single type is wanted.
§Precedence was measured, not assumed
No precedence table exists in the published reference, so rather than copy C’s and hope, each relation below was established by evaluating an expression on a live engine and reading the result:
| Expression | Result | What it establishes |
|---|---|---|
2+3*4 | 14 | * binds inside + |
1 << 2 + 1 | 8 | + binds inside << |
1 & 3 == 3 | 1 | == binds inside & |
1 | 2 & 3 | 3 | & binds inside | |
1 ^ 2 & 3 | 3 | & binds inside ^ |
0 || 1 && 0 | False | && binds inside || |
Giving levels 1 (tightest) through 10 (loosest). Assignment reports None:
it binds loosest, but its exact level was never measured, and an unverified
number presented as fact is the thing this crate refuses to ship.
Re-exports§
pub use arithmetic::ArithmeticOperator;pub use assignment::AssignmentOperator;pub use bitwise::BitwiseOperator;pub use comparison::ComparisonOperator;pub use logical::LogicalOperator;pub use other::OtherOperator;
Modules§
- arithmetic
- Arithmetic operators.
- assignment
- Assignment operators.
- bitwise
- Bitwise operators.
- comparison
- Comparison operators.
- logical
- Logical operators.
- other
- Operators that shape an expression rather than compute a value.
Enums§
- Arity
- How many operands an operator takes.
- Operator
- Any operator in the expression language.
- Operator
Class - The family an operator belongs to.