pub enum Expr {
Show 21 variants
Lit(Value),
UnitLit {
num: f64,
unit: String,
},
Template(Vec<TPart>),
Name(String),
Ctx(String),
Referrers {
ty: String,
member: String,
},
Obj(Vec<(String, Rc<Expr>)>),
Arr(Vec<(bool, Rc<Expr>)>),
Comp {
head: Rc<Expr>,
clauses: Vec<ForClause>,
},
MapComp {
key: Rc<Expr>,
val: Rc<Expr>,
clauses: Vec<ForClause>,
},
Bin {
op: String,
l: Rc<Expr>,
r: Rc<Expr>,
},
Un {
op: String,
x: Rc<Expr>,
},
Paren(Rc<Expr>),
If {
c: Rc<Expr>,
t: Rc<Expr>,
f: Rc<Expr>,
},
Lambda {
params: Vec<String>,
body: Rc<Expr>,
},
Call {
fun: Rc<Expr>,
args: Vec<Rc<Expr>>,
},
Member {
x: Rc<Expr>,
name: String,
safe: bool,
},
Index {
x: Rc<Expr>,
i: Rc<Expr>,
},
With {
base: Rc<Expr>,
patch: Rc<Expr>,
},
Pattern(String),
Match {
subject: Rc<Expr>,
arms: Vec<MatchArm>,
},
}Expand description
an expression (§4)
Variants§
Lit(Value)
a literal
UnitLit
a unit literal
Template(Vec<TPart>)
a template string
Name(String)
a name
Ctx(String)
a context variable ($this, $parent, $root, $key)
Referrers
$referrers(T, "m")
Obj(Vec<(String, Rc<Expr>)>)
a record literal
Arr(Vec<(bool, Rc<Expr>)>)
an array literal: (spread, item)
Comp
an array comprehension
MapComp
a map comprehension
Bin
a binary operation
Un
a unary operation
Paren(Rc<Expr>)
a parenthesized expression
If
if … then … else
Lambda
a function literal
Call
a call
Member
a member access
Index
an index or key access
With
a record update (with)
Pattern(String)
a pattern literal
Match
a match
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Expr
impl !Send for Expr
impl !Sync for Expr
impl !UnwindSafe for Expr
impl Freeze for Expr
impl Unpin for Expr
impl UnsafeUnpin 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