pub enum Expr {
Show 18 variants
Array(ExprArray),
Binary(ExprBinary),
Call(ExprCall),
CallOptions(ExprCallOptions),
Delete(ExprDelete),
Ident(SolIdent),
Index(ExprIndex),
Lit(Lit),
LitDenominated(LitDenominated),
Member(ExprMember),
New(ExprNew),
Payable(ExprPayable),
Postfix(ExprPostfix),
Ternary(ExprTernary),
Tuple(ExprTuple),
Type(Type),
TypeCall(ExprTypeCall),
Unary(ExprUnary),
}
Expand description
An expression.
Solidity reference: https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.expression
Variants§
Array(ExprArray)
An array literal expression: [a, b, c, d]
.
Binary(ExprBinary)
A binary operation: a + b
, a += b
.
Call(ExprCall)
A function call expression: foo(42)
or foo({ bar: 42 })
.
CallOptions(ExprCallOptions)
Function call options: foo.bar{ value: 1, gas: 2 }
.
Delete(ExprDelete)
A unary delete
expression: delete vector
.
Ident(SolIdent)
An identifier: foo
.
Index(ExprIndex)
A square bracketed indexing expression: vector[2]
.
Lit(Lit)
A literal: hex"1234"
.
LitDenominated(LitDenominated)
A number literal with a sub-denomination: 1 ether
.
Member(ExprMember)
Access of a named member: obj.k
.
New(ExprNew)
A new
expression: new Contract
.
Payable(ExprPayable)
A payable
expression: payable(address(0x...))
.
Postfix(ExprPostfix)
A postfix unary expression: foo++
.
Ternary(ExprTernary)
A ternary (AKA conditional) expression: foo ? bar : baz
.
Tuple(ExprTuple)
A tuple expression: (a, b, c, d)
.
Type(Type)
A type name.
Cannot be Custom
, as custom identifiers are parsed as Ident
instead.
TypeCall(ExprTypeCall)
A type()
expression: type(uint256)
Unary(ExprUnary)
A unary operation: !x
, -x
.
Implementations§
Source§impl Expr
impl Expr
pub fn peel_parens(&self) -> &Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl !Send for Expr
impl !Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 120 bytes
Size for each variant:
Array
: 32 bytesBinary
: 60 bytesCall
: 48 bytesCallOptions
: 36 bytesDelete
: 20 bytesIdent
: 24 bytesIndex
: 40 bytesLit
: 20 bytesLitDenominated
: 28 bytesMember
: 24 bytesNew
: 112 bytesPayable
: 56 bytesPostfix
: 36 bytesTernary
: 40 bytesTuple
: 32 bytesType
: 100 bytesTypeCall
: 120 bytesUnary
: 36 bytes