[][src]Enum rhai::Expr

pub enum Expr {
    DynamicConstant(Box<Dynamic>, Position),
    BoolConstant(boolPosition),
    IntegerConstant(INTPosition),
    FloatConstant(FLOATPosition),
    CharConstant(charPosition),
    StringConstant(ImmutableStringPosition),
    FnPointer(ImmutableStringPosition),
    Array(Box<StaticVec<Expr>>, Position),
    Map(Box<StaticVec<(Ident, Expr)>>, Position),
    Unit(Position),
    Variable(Box<(Option<NonZeroUsize>, Option<(NonZeroU64, NamespaceRef)>, Ident)>),
    Property(Box<(ImmutableString, ImmutableString, Ident)>),
    Stmt(Box<StaticVec<Stmt>>, Position),
    FnCall(Box<FnCallExpr>, Position),
    Dot(Box<BinaryExpr>, Position),
    Index(Box<BinaryExpr>, Position),
    In(Box<BinaryExpr>, Position),
    And(Box<BinaryExpr>, Position),
    Or(Box<BinaryExpr>, Position),
    Custom(Box<CustomExpr>, Position),
}

(INTERNALS) An expression sub-tree. Exported under the internals feature only.

WARNING

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

Floating-point constant.

CharConstant(charPosition)

Character constant.

StringConstant(ImmutableStringPosition)

String constant.

FnPtr constant.

[ expr, ... ]

#{ name:expr, ... }

Unit(Position)

()

Variable access - (optional index, optional (hash, modules), variable name)

Property access - (getter, setter), prop

func ( expr , ... )

lhs . rhs

expr [ expr ]

lhs in rhs

lhs && rhs

lhs || rhs

Custom syntax

Implementations

impl Expr[src]

pub fn get_constant_value(&self) -> Option<Dynamic>[src]

Get the Dynamic value of a constant expression.

Returns None if the expression is not constant.

pub fn position(&self) -> Position[src]

Get the position of the expression.

pub fn set_position(&mut self, new_pos: Position) -> &mut Self

Notable traits for &'_ mut R

impl<'_, R> Read for &'_ mut R where
    R: Read + ?Sized
impl<'_, W> Write for &'_ mut W where
    W: Write + ?Sized
impl<'_, F> Future for &'_ mut F where
    F: Unpin + Future + ?Sized
type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Override the position of the expression.

pub fn is_pure(&self) -> bool[src]

Is the expression pure?

A pure expression has no side effects.

pub fn is_unit(&self) -> bool[src]

Is the expression the unit () literal?

pub fn is_constant(&self) -> bool[src]

Is the expression a constant?

pub fn is_valid_postfix(&self, token: &Token) -> bool[src]

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

Trait Implementations

impl Clone for Expr[src]

impl Debug for Expr[src]

impl Default for Expr[src]

impl<'a> From<&'a Expr> for Expression<'a>[src]

Auto Trait Implementations

impl !RefUnwindSafe for Expr[src]

impl !Send for Expr[src]

impl !Sync for Expr[src]

impl Unpin for Expr[src]

impl !UnwindSafe for Expr[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.