pub enum BinaryOpKind {
Show 24 variants
Add,
Subtract,
Multiply,
Pow,
Divide,
ExactDivide,
FloorDivide,
Modulo,
Eq,
NotEq,
Lt,
Gt,
LtEq,
GtEq,
And,
Or,
Concat,
SeqConcat,
ApproxEq,
BitXor,
BitAnd,
BitOr,
Shl,
Shr,
}Expand description
Binary operation kinds for imperative expressions.
Variants§
Add
Subtract
Multiply
Pow
a ** b — exponentiation. Integer power is EXACT (promotes to BigInt on
overflow); a Float operand uses powf; a negative integer exponent is a
loud error. Binds tighter than * / %, right-associative.
Divide
ExactDivide
EXACT division — the type-directed sibling of BinaryOpKind::Divide.
Divide floors (7 / 2 → 3, the integer default); ExactDivide keeps the
quotient exact (7 / 2 → 7/2, a Rational). The resolve_divisions pass
rewrites Divide → ExactDivide only where the result flows into a Rational
context, so existing (floor) code is untouched.
FloorDivide
a // b — FLOOR division, rounding toward negative infinity (-7 // 2 → -4).
Distinct from BinaryOpKind::Divide, which truncates toward zero (-7 / 2 → -3); the two agree when the operands share a sign. Exact (promotes to BigInt),
integer-producing, and immune to the resolve_divisions Rational rewrite — the
explicit spelling for “give me the floored integer quotient.”
Modulo
Eq
NotEq
Lt
Gt
LtEq
GtEq
And
Or
Concat
String concatenation (“X combined with Y”)
SeqConcat
Sequence concatenation (“A followed by B”) — merge two sequences into one.
ApproxEq
Tolerant float comparison (“a is approximately b”) — Python-isclose
semantics (rel 1e-9, abs floor 1e-12). == stays IEEE bit-exact;
this is the EXPLICIT spelling for near-equality.
BitXor
Bitwise XOR: x ^ y (the word xor is the English spelling); on
Sets, symmetric difference.
BitAnd
Bitwise AND: x & y; on Sets, intersection.
BitOr
Bitwise OR: x | y; on Sets, union.
Shl
Left shift: “x shifted left by y” → x << y
Shr
Right shift: “x shifted right by y” → x >> y
Trait Implementations§
Source§impl Clone for BinaryOpKind
impl Clone for BinaryOpKind
Source§fn clone(&self) -> BinaryOpKind
fn clone(&self) -> BinaryOpKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BinaryOpKind
impl Debug for BinaryOpKind
Source§impl Hash for BinaryOpKind
impl Hash for BinaryOpKind
Source§impl PartialEq for BinaryOpKind
impl PartialEq for BinaryOpKind
Source§fn eq(&self, other: &BinaryOpKind) -> bool
fn eq(&self, other: &BinaryOpKind) -> bool
self and other values to be equal, and is used by ==.impl Copy for BinaryOpKind
impl Eq for BinaryOpKind
impl StructuralPartialEq for BinaryOpKind
Auto Trait Implementations§
impl Freeze for BinaryOpKind
impl RefUnwindSafe for BinaryOpKind
impl Send for BinaryOpKind
impl Sync for BinaryOpKind
impl Unpin for BinaryOpKind
impl UnsafeUnpin for BinaryOpKind
impl UnwindSafe for BinaryOpKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.