#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum AssignOp {
Assign,
Add,
Sub,
Mul,
Div,
Mod,
Exp,
And,
Or,
Xor,
Shl,
Shr,
Ushr,
BoolAnd,
BoolOr,
Coalesce,
}
impl AssignOp {
const fn as_str(self) -> &'static str {
match self {
Self::Assign => "=",
Self::Add => "+=",
Self::Sub => "-=",
Self::Mul => "*=",
Self::Exp => "**=",
Self::Div => "/=",
Self::Mod => "%=",
Self::And => "&=",
Self::Or => "|=",
Self::Xor => "^=",
Self::Shl => "<<=",
Self::Shr => ">>=",
Self::Ushr => ">>>=",
Self::BoolAnd => "&&=",
Self::BoolOr => "||=",
Self::Coalesce => "??=",
}
}
}
impl std::fmt::Display for AssignOp {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.as_str())
}
}