pub enum Expr {
Show 18 variants
Int(i64, Span),
Float(f64, Span),
Str(String, Span),
Bool(bool, Span),
Null(Span),
Ident(String, Span),
Binary {
left: Box<Expr>,
op: BinOp,
right: Box<Expr>,
span: Span,
},
Unary {
op: UnaryOp,
operand: Box<Expr>,
span: Span,
},
Call {
func: String,
args: Vec<Arg>,
span: Span,
},
QualifiedCall {
path: Vec<String>,
args: Vec<Arg>,
span: Span,
},
Member {
object: Box<Expr>,
field: String,
span: Span,
},
Index {
object: Box<Expr>,
index: Box<Expr>,
end: Option<Box<Expr>>,
span: Span,
},
List(Vec<Expr>, Span),
Dict(Vec<(String, Expr)>, Span),
Paren(Box<Expr>, Span),
IfExpr {
cond: Box<Expr>,
then_branch: Box<Expr>,
else_branch: Option<Box<Expr>>,
span: Span,
},
RepeatExpr {
count: Box<Expr>,
body: Box<Expr>,
span: Span,
},
Closure {
params: Vec<String>,
body: Box<Expr>,
span: Span,
},
}Variants§
Int(i64, Span)
Integer literal: 42
Float(f64, Span)
Float literal: 3.14
Str(String, Span)
String literal: "hello"
Bool(bool, Span)
Boolean: true, false
Null(Span)
Null: null
Ident(String, Span)
Identifier: x, Batch
Binary
Binary expression: a + b
Unary
Unary expression: -x, !cond
Call
Function call: matmul(x, w)
QualifiedCall
Qualified call: module.func(args) or mod::func(args)
Member
Member access: x.shape
Index
Index access: x[0] or x[1:3]
List(Vec<Expr>, Span)
List expression: [1, 2, 3]
Dict(Vec<(String, Expr)>, Span)
Dict expression: { key: value, ... }
Paren(Box<Expr>, Span)
Parenthesized: (expr)
IfExpr
Block operation — if
RepeatExpr
Block operation — repeat
Closure
Closure: |a, b| { expr }
Implementations§
Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more