pub enum Expr {
Show 20 variants
Str(String),
Number(f64),
Bool(bool),
Unit,
Ident(String),
Do(Vec<Stmt>),
If {
cond: Box<Expr>,
then: Vec<Stmt>,
elseifs: Vec<(Expr, Vec<Stmt>)>,
else_body: Option<Vec<Stmt>>,
},
For {
var: String,
iter: Box<Expr>,
body: Vec<Stmt>,
},
While {
cond: Box<Expr>,
body: Vec<Stmt>,
},
Match(Box<Expr>, Vec<MatchArm>),
Call(Box<Expr>, Vec<Expr>),
MethodCall {
receiver: Box<Expr>,
method: String,
args: Vec<Expr>,
},
Path(Vec<String>),
Range(Box<Expr>, Box<Expr>),
Ref(Box<Expr>),
Await(Box<Expr>),
BinOp(BinOp, Box<Expr>, Box<Expr>),
Array(Vec<Expr>),
Index(Box<Expr>, Box<Expr>),
Closure(Vec<String>, Box<Expr>),
}Variants§
Str(String)
Number(f64)
Bool(bool)
Unit
Ident(String)
Do(Vec<Stmt>)
do { stmts } or anonymous block { stmts }
If
if cond { then } (else if cond { elif })* (else { else_body })?
For
for name in iterable { body }
While
while cond { body } / ขณะที่ cond { body }
Match(Box<Expr>, Vec<MatchArm>)
match expr { arms }
Call(Box<Expr>, Vec<Expr>)
Normal call: expr(args)
MethodCall
Method call: receiver.method(args)
Path(Vec<String>)
Path like Mod::fn or just chained idents; resolved at runtime
Range(Box<Expr>, Box<Expr>)
lo..hi
Ref(Box<Expr>)
&expr
Await(Box<Expr>)
await expr
BinOp(BinOp, Box<Expr>, Box<Expr>)
Binary operation
Array(Vec<Expr>)
Array/Vec literal [a, b, c]
Index(Box<Expr>, Box<Expr>)
expr[idx]
Closure(Vec<String>, Box<Expr>)
Closure || expr or |args| expr
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 UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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