pub enum BinOp {
Show 25 variants
Add,
Sub,
Mul,
Div,
Rem,
Shl,
Shr,
UShr,
Lt,
Le,
Gt,
Ge,
Eq,
Ne,
BitAnd,
BitXor,
BitOr,
And,
Or,
Pow,
StrictEq,
StrictNe,
Nullish,
In,
Instanceof,
}Expand description
二元运算符(规范词汇表,语言负责映射)。
Variants§
Add
Sub
Mul
Div
Rem
Shl
Shr
UShr
Lt
Le
Gt
Ge
Eq
Ne
BitAnd
BitXor
BitOr
And
Or
Pow
**(幂)。右结合且非结合律——重结合类规则须跳过。
StrictEq
===(严格相等)。与 BinOp::Eq(宽松 ==)语义不同:
折叠规则必须按语言语义分别处理。
StrictNe
!==(严格不等)。
Nullish
??(空值合并——非短路布尔:返回操作数值而非布尔)。
In
in(属性存在性,二元关系)。
Instanceof
instanceof(JS 的二元运算形态,RHS 是任意表达式)。
Implementations§
Source§impl BinOp
impl BinOp
pub fn is_comparison(self) -> bool
pub fn is_short_circuit(self) -> bool
Sourcepub fn may_div_zero(self) -> bool
pub fn may_div_zero(self) -> bool
可能因除零抛异常的运算。
Trait Implementations§
impl Copy for BinOp
impl Eq for BinOp
impl StructuralPartialEq for BinOp
Auto Trait Implementations§
impl Freeze for BinOp
impl RefUnwindSafe for BinOp
impl Send for BinOp
impl Sync for BinOp
impl Unpin for BinOp
impl UnsafeUnpin for BinOp
impl UnwindSafe for BinOp
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