Enum quad_compat_rhai::Expr[][src]

pub enum Expr {
Show 20 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>, boolPosition), Index(Box<BinaryExpr>, boolPosition), 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)

Tuple Fields

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(boolPosition)

Tuple Fields

0: bool

Boolean constant.

IntegerConstant(INTPosition)

Tuple Fields

0: INT

Integer constant.

FloatConstant(FloatWrapper<FLOAT>, Position)

Tuple Fields

Floating-point constant.

Not available under no_float.

CharConstant(charPosition)

Tuple Fields

0: char

Character constant.

StringConstant(ImmutableStringPosition)

Tuple Fields

String constant.

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

Tuple Fields

An interpolated string.

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

Tuple Fields

[ expr, … ]

Map(Box<(StaticVec<(Ident, Expr)>, BTreeMap<Identifier, Dynamic>)>, Position)

#{ name:expr, … }

Unit(Position)

Tuple Fields

()

Variable(Option<NonZeroU8>, PositionBox<(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))>)

Property access - ((getter, hash), (setter, hash), prop)

Stack(usizePosition)

Tuple Fields

0: usize

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>)

Tuple Fields

{ statement … }

FnCall(Box<FnCallExpr>, Position)

Tuple Fields

func ( expr ,)

Dot(Box<BinaryExpr>, boolPosition)

Tuple Fields

1: bool

lhs . rhs - bool variable is a dummy

Index(Box<BinaryExpr>, boolPosition)

Tuple Fields

1: bool

expr [ expr ] - boolean indicates whether the dotting/indexing chain stops

And(Box<BinaryExpr>, Position)

Tuple Fields

lhs && rhs

Or(Box<BinaryExpr>, Position)

Tuple Fields

lhs || rhs

Custom(Box<CustomExpr>, Position)

Tuple Fields

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

Performs the conversion.

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.

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)

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.