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(Box<(Option<NonZeroUsize>, Namespace, u64, Identifier)>, Option<NonZeroU8>, Position), Property(Box<((Identifier, u64), (Identifier, u64), ImmutableString)>, Position), MethodCall(Box<FnCallExpr>, Position), Stmt(Box<StmtBlock>), FnCall(Box<FnCallExpr>, Position), Dot(Box<BinaryExpr>, ASTFlagsPosition), Index(Box<BinaryExpr>, ASTFlagsPosition), 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(boolPosition)

Boolean constant.

IntegerConstant(INTPosition)

Integer constant.

FloatConstant(FloatWrapper<FLOAT>, Position)

Floating-point constant.

CharConstant(charPosition)

Character constant.

StringConstant(ImmutableStringPosition)

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)

()

Variable(Box<(Option<NonZeroUsize>, Namespace, u64, Identifier)>, Option<NonZeroU8>, Position)

Variable access - (optional long index, namespace, namespace hash, variable name), optional short index, position

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)

MethodCall(Box<FnCallExpr>, Position)

xxx . method ( expr ,)

Stmt(Box<StmtBlock>)

{ statement … }

FnCall(Box<FnCallExpr>, Position)

func ( expr ,)

Dot(Box<BinaryExpr>, ASTFlagsPosition)

lhs . rhs

Index(Box<BinaryExpr>, ASTFlagsPosition)

lhs [ rhs ]

Flags

NONE = recurse into the indexing chain BREAK = terminate the indexing chain

And(Box<BinaryExpr>, Position)

lhs && rhs

Or(Box<BinaryExpr>, Position)

lhs || rhs

Custom(Box<CustomExpr>, Position)

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.

Get the starting position of the expression. For a binary expression, this will be the left-most LHS instead of the operator.

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

Converts this type into a shared reference of the (usually inferred) input type.

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

Converts to this type from the input type.

Converts to this type from the input type.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.