Enum rhai::Expr [−][src]
pub enum Expr {}Show 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>>), Array(Box<StaticVec<Expr>>, Position), Map(Box<(StaticVec<(Ident, Expr)>, BTreeMap<Identifier, Dynamic>)>, Position), Unit(Position), Variable(Option<NonZeroU8>, Position, Box<(Option<NonZeroUsize>, Option<(u64, NamespaceRef)>, Identifier)>), Property(Box<((Identifier, u64), (Identifier, u64), (ImmutableString, Position))>), 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
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.
Boolean constant.
Integer constant.
FloatConstant(FloatWrapper<FLOAT>, Position)
Floating-point constant.
Not available under no_float
.
Character constant.
StringConstant(ImmutableString, Position)
String constant.
An interpolated string.
[ expr, … ]
#{ name:expr, … }
Unit(Position)
()
Variable(Option<NonZeroU8>, Position, Box<(Option<NonZeroUsize>, Option<(u64, NamespaceRef)>, 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)
{ statement … }
FnCall(Box<FnCallExpr>, Position)
func (
expr ,
… )
Dot(Box<BinaryExpr>, Position)
lhs .
rhs
Index(Box<BinaryExpr>, Position)
expr [
expr ]
And(Box<BinaryExpr>, Position)
lhs &&
rhs
Or(Box<BinaryExpr>, Position)
lhs ||
rhs
Custom(Box<CustomExpr>, Position)
Custom syntax
Implementations
impl Expr
[src]
impl Expr
[src]pub fn get_constant_value(&self) -> Option<Dynamic>
[src]
pub fn get_constant_value(&self) -> Option<Dynamic>
[src]pub fn set_position(&mut self, new_pos: Position) -> &mut Self
[src]
pub fn set_position(&mut self, new_pos: Position) -> &mut Self
[src]Override the position of the expression.
pub fn is_constant(&self) -> bool
[src]
pub fn is_constant(&self) -> bool
[src]Is the expression a constant?
pub fn is_valid_postfix(&self, token: &Token) -> bool
[src]
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<'a> From<&'a Expr> for Expression<'a>
[src]
impl<'a> From<&'a Expr> for Expression<'a>
[src]Auto Trait Implementations
impl !RefUnwindSafe for Expr
impl !Send for Expr
impl !Sync for Expr
impl Unpin for Expr
impl !UnwindSafe for Expr
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more