#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum UnaryOp {
Minus,
Plus,
Not,
Tilde,
TypeOf,
Delete,
Void,
}
impl UnaryOp {
const fn as_str(self) -> &'static str {
match self {
Self::Plus => "+",
Self::Minus => "-",
Self::Not => "!",
Self::Tilde => "~",
Self::Delete => "delete",
Self::TypeOf => "typeof",
Self::Void => "void",
}
}
}
impl std::fmt::Display for UnaryOp {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.as_str())
}
}