pub enum Expr {
Show 15 variants
Literal(Literal),
Identifier(String),
UnaryOp {
op: UnaryOperator,
operand: Box<Expr>,
},
BinaryOp {
op: BinaryOperator,
left: Box<Expr>,
right: Box<Expr>,
},
Conditional {
cond: Box<Expr>,
true_branch: Box<Expr>,
false_branch: Box<Expr>,
},
List {
elements: Vec<Expr>,
},
FieldAccess {
base: Box<Expr>,
field: String,
},
Call {
target: Box<Expr>,
args: Vec<Expr>,
},
Index {
base: Box<Expr>,
index: Box<Expr>,
},
MapLiteral {
entries: Vec<(Expr, Expr)>,
},
MessageLiteral {
type_name: String,
fields: Vec<(String, Expr)>,
},
Has {
target: Box<Expr>,
},
Comprehension {
op: ComprehensionOp,
target: Box<Expr>,
iter_var: String,
predicate: Box<Expr>,
},
Map {
target: Box<Expr>,
iter_var: String,
filter: Option<Box<Expr>>,
transform: Box<Expr>,
},
Type(CelType),
}Variants§
Literal(Literal)
Identifier(String)
UnaryOp
BinaryOp
Conditional
List
FieldAccess
Call
Index
MapLiteral
MessageLiteral
Has
Comprehension
Map
Type(CelType)
Implementations§
Source§impl Expr
impl Expr
pub fn accept<'ast, V: Visitor<'ast>>(&'ast self, visitor: &mut V)
pub fn is_literal(&self) -> bool
pub fn as_literal(&self) -> Option<&Literal>
pub fn as_identifier(&self) -> Option<&str>
pub fn as_binary_op(&self) -> Option<(BinaryOperator, &Expr, &Expr)>
pub fn as_unary_op(&self) -> Option<(UnaryOperator, &Expr)>
pub fn as_call(&self) -> Option<(&Expr, &[Expr])>
Trait Implementations§
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
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