pub enum Expression {
Show 15 variants
String(Vec<StringPart>, Span),
Number(f64, Span),
Boolean(bool, Span),
Identifier(String, Span),
Null(Span),
Array(Vec<Expression>, Span),
Object(Vec<(String, Expression)>, Span),
Binary(BinaryOp, Box<Expression>, Box<Expression>, Span),
Unary(UnaryOp, Box<Expression>, Span),
Call(Box<Expression>, Vec<Expression>, Span),
Member(Box<Expression>, String, Span),
Index(Box<Expression>, Box<Expression>, Span),
Range(Box<Expression>, Box<Expression>, Span),
Lambda(Lambda),
Match(MatchExpr),
}Expand description
An expression in GENT
Variants§
String(Vec<StringPart>, Span)
String literal: "hello" or interpolated string: "Hello, ${name}!"
Number(f64, Span)
Number literal: 42 or 3.14
Boolean(bool, Span)
Boolean literal: true or false
Identifier(String, Span)
Identifier reference: varName
Null(Span)
Null literal: null
Array(Vec<Expression>, Span)
Array literal: [1, 2, 3]
Object(Vec<(String, Expression)>, Span)
Object literal: {key: value}
Binary(BinaryOp, Box<Expression>, Box<Expression>, Span)
Binary operation: a + b
Unary(UnaryOp, Box<Expression>, Span)
Unary operation: -x, !x
Call(Box<Expression>, Vec<Expression>, Span)
Function call: foo(args)
Member(Box<Expression>, String, Span)
Member access: obj.prop
Index(Box<Expression>, Box<Expression>, Span)
Index access: arr[0]
Range(Box<Expression>, Box<Expression>, Span)
Range expression (start..end)
Lambda(Lambda)
Lambda expression: (x) => x * 2
Match(MatchExpr)
Match expression: match value { Pattern => result }
Implementations§
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl PartialEq for Expression
impl PartialEq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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