pub enum CExpr {
Show 14 variants
Var(String),
IntLit(i64),
UIntLit(u64),
StringLit(String),
Call(String, Vec<CExpr>),
BinOp(CBinOp, Box<CExpr>, Box<CExpr>),
UnaryOp(CUnaryOp, Box<CExpr>),
FieldAccess(Box<CExpr>, String, bool),
ArrayAccess(Box<CExpr>, Box<CExpr>),
Cast(CType, Box<CExpr>),
SizeOf(CType),
Null,
Ternary(Box<CExpr>, Box<CExpr>, Box<CExpr>),
Initializer(CType, Vec<(String, CExpr)>),
}Expand description
C expression for code generation.
Variants§
Var(String)
Variable reference.
IntLit(i64)
Integer literal.
UIntLit(u64)
Unsigned integer literal.
StringLit(String)
String literal.
Call(String, Vec<CExpr>)
Function call: f(args...).
BinOp(CBinOp, Box<CExpr>, Box<CExpr>)
Binary operation: lhs op rhs.
UnaryOp(CUnaryOp, Box<CExpr>)
Unary operation: op expr.
FieldAccess(Box<CExpr>, String, bool)
Field access: expr.field or expr->field.
ArrayAccess(Box<CExpr>, Box<CExpr>)
Array access: expr[index].
Cast(CType, Box<CExpr>)
Cast: (type)expr.
SizeOf(CType)
sizeof(type).
Null
NULL.
Ternary(Box<CExpr>, Box<CExpr>, Box<CExpr>)
Ternary: cond ? then : else.
Initializer(CType, Vec<(String, CExpr)>)
Compound literal / initializer.
Trait Implementations§
impl StructuralPartialEq for CExpr
Auto Trait Implementations§
impl Freeze for CExpr
impl RefUnwindSafe for CExpr
impl Send for CExpr
impl Sync for CExpr
impl Unpin for CExpr
impl UnsafeUnpin for CExpr
impl UnwindSafe for CExpr
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