pub enum ExprKind {
Show 28 variants
Literal(LiteralExpr),
FieldRef(FieldRefExpr),
Sizeof(SizeofExpr),
Alignof(AlignofExpr),
Add(AddExpr),
Sub(SubExpr),
Mul(MulExpr),
Div(DivExpr),
Mod(ModExpr),
Pow(PowExpr),
BitAnd(BitAndExpr),
BitOr(BitOrExpr),
BitXor(BitXorExpr),
LeftShift(LeftShiftExpr),
RightShift(RightShiftExpr),
BitNot(BitNotExpr),
Neg(NegExpr),
Not(NotExpr),
Popcount(PopcountExpr),
Eq(EqExpr),
Ne(NeExpr),
Lt(LtExpr),
Gt(GtExpr),
Le(LeExpr),
Ge(GeExpr),
And(AndExpr),
Or(OrExpr),
Xor(XorExpr),
}Variants§
Literal(LiteralExpr)
FieldRef(FieldRefExpr)
Sizeof(SizeofExpr)
Alignof(AlignofExpr)
Add(AddExpr)
Sub(SubExpr)
Mul(MulExpr)
Div(DivExpr)
Mod(ModExpr)
Pow(PowExpr)
BitAnd(BitAndExpr)
BitOr(BitOrExpr)
BitXor(BitXorExpr)
LeftShift(LeftShiftExpr)
RightShift(RightShiftExpr)
BitNot(BitNotExpr)
Neg(NegExpr)
Not(NotExpr)
Popcount(PopcountExpr)
Eq(EqExpr)
Ne(NeExpr)
Lt(LtExpr)
Gt(GtExpr)
Le(LeExpr)
Ge(GeExpr)
And(AndExpr)
Or(OrExpr)
Xor(XorExpr)
Implementations§
Source§impl ExprKind
impl ExprKind
Sourcepub fn try_evaluate_constant(&self) -> Option<u64>
pub fn try_evaluate_constant(&self) -> Option<u64>
Recursively evaluate this expression to a constant value if possible Returns None if the expression contains unresolvable references (like field refs)
Sourcepub fn to_c_string(&self) -> String
pub fn to_c_string(&self) -> String
Format the expression as a C-style mathematical expression This format is compatible with C, Rust, and TypeScript for most operations
Sourcepub fn to_debug_string(&self) -> String
pub fn to_debug_string(&self) -> String
Generate a debug string representation of the expression
Trait Implementations§
Source§impl ConstantExpression for ExprKind
impl ConstantExpression for ExprKind
fn is_constant(&self) -> bool
Source§impl<'de> Deserialize<'de> for ExprKind
impl<'de> Deserialize<'de> for ExprKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ExprKind
impl StructuralPartialEq for ExprKind
Auto Trait Implementations§
impl Freeze for ExprKind
impl RefUnwindSafe for ExprKind
impl Send for ExprKind
impl Sync for ExprKind
impl Unpin for ExprKind
impl UnsafeUnpin for ExprKind
impl UnwindSafe for ExprKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.