Enum quad_compat_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.
Variants
DynamicConstant(Box<Dynamic>, Position)
Dynamic constant.
Used to hold complex constants such as Array
or Map
for quick cloning.
Primitive data types should use the appropriate variants to avoid an allocation.
BoolConstant(bool, Position)
Boolean constant.
IntegerConstant(INT, Position)
Integer constant.
FloatConstant(FloatWrapper<FLOAT>, Position)
Floating-point constant.
Not available under no_float
.
CharConstant(char, Position)
Character constant.
StringConstant(ImmutableString, Position)
String constant.
InterpolatedString(Box<StaticVec<Expr>>, Position)
An interpolated string.
Array(Box<StaticVec<Expr>>, Position)
[ expr, … ]
Map(Box<(StaticVec<(Ident, Expr)>, BTreeMap<Identifier, Dynamic>)>, Position)
#{ name:expr, … }
Unit(Position)
Tuple Fields
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.
Property(Box<((Identifier, u64), (Identifier, u64), (ImmutableString, Position))>)
Tuple Fields
0: Box<((Identifier, u64), (Identifier, u64), (ImmutableString, Position))>
Property access - ((getter, hash), (setter, hash), prop)
Stack(usize, Position)
Stack slot for function calls. See FnCallExpr
for more details.
This variant does not map to any language structure. It is used in function calls with
constant arguments where the usize
number indexes into an array containing a list of
constant arguments for the function call.
Stmt(Box<StmtBlock>)
{ statement … }
FnCall(Box<FnCallExpr>, Position)
func (
expr ,
… )
Dot(Box<BinaryExpr>, bool, Position)
lhs .
rhs - bool variable is a dummy
Index(Box<BinaryExpr>, bool, Position)
expr [
expr ]
- boolean indicates whether the dotting/indexing chain stops
And(Box<BinaryExpr>, Position)
lhs &&
rhs
Or(Box<BinaryExpr>, Position)
lhs ||
rhs
Custom(Box<CustomExpr>, Position)
Custom syntax
Implementations
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Expr
impl !UnwindSafe for Expr
Blanket Implementations
Mutably borrows from an owned value. Read more