Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Operator Precedence

The table below defines operator precedence from tightest-binding (top) to loosest-binding (bottom).

OperatorAssociativityGrammar
Binds tighter
. ->left
has, is, matcheslefthas_expr is_expr matches_expr
* / %leftarith_expr
+ -leftarith_expr
<< >>leftbit_expr
&leftbit_expr
^leftbit_expr
|leftbit_expr
!== == != <= < >= >requires parenthesesequality_expr ineq_expr
&&leftand_expr
||leftor_expr
==>rightimplies_expr
<==leftexplies_expr
<==>requires parenthesesiff_expr
..left
=right
closures; forall, exists; chooserightforall_expr exists_expr choose_expr
&&&leftprefix_and_expr
|||leftprefix_or_expr
Binds looser

All operators that are from ordinary Rust have the same precedence-ordering as in ordinary Rust. See also the Rust operator precedence.