syn_solidity

Enum Expr

Source
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

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

Source

pub fn peel_parens(&self) -> &Self

Trait Implementations§

Source§

impl Clone for Expr

Source§

fn clone(&self) -> Expr

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Expr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Parse for Expr

Source§

fn parse(input: ParseStream<'_>) -> Result<Self>

Source§

impl Spanned for Expr

Source§

fn span(&self) -> Span

Returns a Span covering the complete contents of this syntax tree node, or Span::call_site() if this node is empty.
Source§

fn set_span(&mut self, span: Span)

Sets the span of this syntax tree node if it is not empty.
Source§

fn with_span(self, span: Span) -> Self
where Self: Sized,

Sets the span of this owned syntax tree node if it is not empty.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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: 160 bytes

Size for each variant:

  • Array: 56 bytes
  • Binary: 72 bytes
  • Call: 80 bytes
  • CallOptions: 64 bytes
  • Delete: 32 bytes
  • Ident: 40 bytes
  • Index: 56 bytes
  • Lit: 40 bytes
  • LitDenominated: 40 bytes
  • Member: 40 bytes
  • New: 160 bytes
  • Payable: 88 bytes
  • Postfix: 48 bytes
  • Ternary: 56 bytes
  • Tuple: 56 bytes
  • Type: 144 bytes
  • TypeCall: 160 bytes
  • Unary: 48 bytes