Enum rhai::Expr[][src]

pub enum Expr {
Show variants DynamicConstant(Box<Dynamic>, Position), BoolConstant(boolPosition), IntegerConstant(INTPosition), FloatConstant(FloatWrapper<FLOAT>, Position), CharConstant(charPosition), StringConstant(ImmutableStringPosition), InterpolatedString(Box<StaticVec<Expr>>, Position), Array(Box<StaticVec<Expr>>, Position), Map(Box<(StaticVec<(Ident, Expr)>, BTreeMap<Identifier, Dynamic>)>, Position), Unit(Position), Variable(Option<NonZeroU8>, PositionBox<(Option<NonZeroUsize>, Option<(NamespaceRef, u64)>, Identifier)>), Property(Box<((Identifier, u64), (Identifier, u64), (ImmutableString, Position))>), Stack(usizePosition), Stmt(Box<StmtBlock>), FnCall(Box<FnCallExpr>, Position), Dot(Box<BinaryExpr>, Position), Index(Box<BinaryExpr>, 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

DynamicConstant(Box<Dynamic>, Position)

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.

BoolConstant(boolPosition)

Boolean constant.

IntegerConstant(INTPosition)

Integer constant.

FloatConstant(FloatWrapper<FLOAT>, Position)

Floating-point constant.

Not available under no_float.

CharConstant(charPosition)

Character constant.

StringConstant(ImmutableStringPosition)

String constant.

InterpolatedString(Box<StaticVec<Expr>>, Position)

An interpolated string.

[ expr, … ]

#{ name:expr, … }

Unit(Position)

()

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 access - ((getter, hash), (setter, hash), prop)

Stack(usizePosition)

Stack slot

Stmt(Box<StmtBlock>)

{ statement … }

func ( expr ,)

lhs . rhs

expr [ expr ]

lhs && rhs

lhs || rhs

Custom syntax

Implementations

Get the Dynamic value of a literal constant expression.

Returns None if the expression is not a literal constant.

Create an Expr from a Dynamic value.

Get the position of the expression.

Override the position of the expression.

Is the expression pure?

A pure expression has no side effects.

Is the expression the unit () literal?

Is the expression a constant?

Is a particular token allowed as a postfix operator to this expression?

Recursively walk this expression. Return false from the callback to terminate the walk.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.