#[non_exhaustive]pub enum BinaryOp {
Show 28 variants
Add,
Sub,
Mul,
Div,
Mod,
Pow,
Concat,
Equal,
NotEqual,
Identical,
NotIdentical,
Less,
Greater,
LessOrEqual,
GreaterOrEqual,
Spaceship,
BooleanAnd,
BooleanOr,
BitwiseAnd,
BitwiseOr,
BitwiseXor,
ShiftLeft,
ShiftRight,
LogicalAnd,
LogicalOr,
LogicalXor,
Instanceof,
Pipe,
}Expand description
Binary operators.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Add
+
Sub
-
Mul
*
Div
/
Mod
%
Pow
**
Concat
. — string concatenation.
Equal
== — loose equality (type-coercing).
NotEqual
!= or <> — loose inequality.
Identical
=== — strict equality (type and value).
NotIdentical
!== — strict inequality.
Less
<
Greater
>
LessOrEqual
<=
GreaterOrEqual
>=
Spaceship
<=> — spaceship / three-way comparison; returns -1, 0, or 1.
BooleanAnd
&& — short-circuit boolean AND (higher precedence than and).
BooleanOr
|| — short-circuit boolean OR (higher precedence than or).
BitwiseAnd
& — bitwise AND.
BitwiseOr
| — bitwise OR.
BitwiseXor
^ — bitwise XOR.
ShiftLeft
<< — left bit-shift.
ShiftRight
>> — right bit-shift.
LogicalAnd
and — boolean AND (lower precedence than &&).
LogicalOr
or — boolean OR (lower precedence than ||).
LogicalXor
xor — boolean XOR.
Instanceof
instanceof — type-check operator; $x instanceof Foo.
Pipe
|> — pipe operator (PHP 8.5+); passes the left operand as the first argument of the right callable.
Trait Implementations§
impl Copy for BinaryOp
impl Eq for BinaryOp
impl StructuralPartialEq for BinaryOp
Auto Trait Implementations§
impl Freeze for BinaryOp
impl RefUnwindSafe for BinaryOp
impl Send for BinaryOp
impl Sync for BinaryOp
impl Unpin for BinaryOp
impl UnsafeUnpin for BinaryOp
impl UnwindSafe for BinaryOp
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