pub enum BinOpKind {
Show 19 variants
Add,
Sub,
Mul,
Div,
Mod,
Pow,
BitAnd,
BitOr,
BitXor,
Shl,
Shr,
Eq,
Ne,
Lt,
Gt,
Le,
Ge,
And,
Or,
}Expand description
Binary arithmetic operator kind.
Variants§
Add
+ — desugars to u64_add or f64_add based on operand types
Sub
- — desugars to u64_sub or f64_sub based on operand types
Mul
* — desugars to u64_mul or f64_mul based on operand types
Div
/ — desugars to u64_div or f64_div based on operand types
Mod
% — desugars to u64_mod or f64_mod based on operand types
Pow
** — desugars to pow(a, b) (always f64)
BitAnd
& — desugars to u64_and(a, b)
BitOr
| — desugars to u64_or(a, b)
BitXor
^ — desugars to u64_xor(a, b)
Shl
<< — desugars to u64_shl(a, b)
Shr
>> — desugars to u64_shr(a, b)
Eq
== — desugars to u64_eq / f64_eq. Output type is u64
(0 = false, 1 = true).
Ne
!= — desugars to u64_ne / f64_ne. Output type is u64.
Lt
< — desugars to u64_lt / f64_lt. Output type is u64.
Gt
> — desugars to u64_gt / f64_gt. Output type is u64.
Le
<= — desugars to u64_le / f64_le. Output type is u64.
Ge
>= — desugars to u64_ge / f64_ge. Output type is u64.
And
&& — eager logical-and (SRD-84 Part 1). Desugars to
u64_and(a != 0, b != 0): both operands evaluate, each is
normalised to truthiness (0/1), and the bitwise-and of two
truthiness values is logical-and. Output type is u64 (0/1).
Lowest precedence, below comparison. Short-circuit is a deferred
optimisation (SRD-84 §“eager”).
Or
|| — eager logical-or (SRD-84 Part 1). Desugars to
u64_or(a != 0, b != 0). Output type is u64 (0/1). Binds
looser than &&.