Enum rhai::Expr [−][src]
pub enum Expr {
Show 20 variants
DynamicConstant(Box<Dynamic>, Position),
BoolConstant(bool, Position),
IntegerConstant(INT, Position),
FloatConstant(FloatWrapper<FLOAT>, Position),
CharConstant(char, Position),
StringConstant(ImmutableString, Position),
InterpolatedString(Box<StaticVec<Expr>>, Position),
Array(Box<StaticVec<Expr>>, Position),
Map(Box<(StaticVec<(Ident, Expr)>, BTreeMap<Identifier, Dynamic>)>, Position),
Unit(Position),
Variable(Option<NonZeroU8>, Position, Box<(Option<NonZeroUsize>, Option<(NamespaceRef, u64)>, Identifier)>),
Property(Box<((Identifier, u64), (Identifier, u64), (ImmutableString, Position))>),
Stack(usize, Position),
Stmt(Box<StmtBlock>),
FnCall(Box<FnCallExpr>, Position),
Dot(Box<BinaryExpr>, bool, Position),
Index(Box<BinaryExpr>, bool, Position),
And(Box<BinaryExpr>, Position),
Or(Box<BinaryExpr>, Position),
Custom(Box<CustomExpr>, Position),
}
Expand description
(internals) An expression sub-tree.
Exported under the internals
feature only.
Volatile Data Structure
This type is volatile and may change.
Variants
Dynamic constant.
Used to hold either an Array
or Map
literal for quick cloning.
All other primitive data types should use the appropriate variants for better speed.
Boolean constant.
Integer constant.
FloatConstant(FloatWrapper<FLOAT>, Position)
Floating-point constant.
Not available under no_float
.
Tuple Fields of FloatConstant
0: FloatWrapper<FLOAT>
1: Position
Character constant.
StringConstant(ImmutableString, Position)
String constant.
Tuple Fields of StringConstant
0: ImmutableString
1: Position
An interpolated string.
[ expr, … ]
#{ name:expr, … }
Unit(Position)
()
Tuple Fields of Unit
0: Position
Variable(Option<NonZeroU8>, Position, Box<(Option<NonZeroUsize>, Option<(NamespaceRef, u64)>, Identifier)>)
Variable access - optional short index, position, (optional index, optional (hash, modules), variable name)
The short index is u8
which is used when the index is <= 255, which should be the vast
majority of cases (unless there are more than 255 variables defined!).
This is to avoid reading a pointer redirection during each variable access.
Tuple Fields of Variable
0: Option<NonZeroU8>
1: Position
2: Box<(Option<NonZeroUsize>, Option<(NamespaceRef, u64)>, Identifier)>
Property(Box<((Identifier, u64), (Identifier, u64), (ImmutableString, Position))>)
Property access - ((getter, hash), (setter, hash), prop)
Tuple Fields of Property
0: Box<((Identifier, u64), (Identifier, u64), (ImmutableString, Position))>
Stack slot
{ statement … }
FnCall(Box<FnCallExpr>, Position)
func (
expr ,
… )
Tuple Fields of FnCall
0: Box<FnCallExpr>
1: Position
Dot(Box<BinaryExpr>, bool, Position)
lhs .
rhs - bool variable is a dummy
Tuple Fields of Dot
Index(Box<BinaryExpr>, bool, Position)
expr [
expr ]
- boolean indicates whether the dotting/indexing chain stops
Tuple Fields of Index
And(Box<BinaryExpr>, Position)
lhs &&
rhs
Tuple Fields of And
0: Box<BinaryExpr>
1: Position
Or(Box<BinaryExpr>, Position)
lhs ||
rhs
Tuple Fields of Or
0: Box<BinaryExpr>
1: Position
Custom(Box<CustomExpr>, Position)
Custom syntax
Tuple Fields of Custom
0: Box<CustomExpr>
1: Position
Implementations
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Expr
impl !UnwindSafe for Expr
Blanket Implementations
Mutably borrows from an owned value. Read more