Skip to main content

VyperExpr

Enum VyperExpr 

Source
pub enum VyperExpr {
Show 37 variants IntLit(i128), BoolLit(bool), StrLit(String), HexLit(String), Var(String), SelfField(String), MsgSender, MsgValue, BlockTimestamp, BlockNumber, ChainId, TxOrigin, Len(Box<VyperExpr>), Convert(Box<VyperExpr>, VyperType), Concat(Vec<VyperExpr>), Keccak256(Box<VyperExpr>), Sha256(Box<VyperExpr>), Ecrecover(Box<VyperExpr>, Box<VyperExpr>, Box<VyperExpr>, Box<VyperExpr>), Extract32(Box<VyperExpr>, Box<VyperExpr>), FieldAccess(Box<VyperExpr>, String), Index(Box<VyperExpr>, Box<VyperExpr>), Call(String, Vec<VyperExpr>), ExtCall(String, Box<VyperExpr>, String, Vec<VyperExpr>), BinOp(String, Box<VyperExpr>, Box<VyperExpr>), UnaryOp(String, Box<VyperExpr>), IfExpr(Box<VyperExpr>, Box<VyperExpr>, Box<VyperExpr>), StructLit(String, Vec<(String, VyperExpr)>), ListLit(Vec<VyperExpr>), Empty(VyperType), MaxValue(VyperType), MinValue(VyperType), Isqrt(Box<VyperExpr>), Uint2Str(Box<VyperExpr>), RawCall { addr: Box<VyperExpr>, data: Box<VyperExpr>, value: Option<Box<VyperExpr>>, gas: Option<Box<VyperExpr>>, }, CreateMinimalProxy(Box<VyperExpr>), CreateCopyOf(Box<VyperExpr>), CreateFromBlueprint(Box<VyperExpr>, Vec<VyperExpr>),
}
Expand description

Vyper expression AST node.

Variants§

§

IntLit(i128)

Integer literal: 42

§

BoolLit(bool)

Boolean literal: True / False

§

StrLit(String)

String literal: "hello"

§

HexLit(String)

Hex literal: 0xdeadbeef

§

Var(String)

Variable reference: my_var

§

SelfField(String)

self.field — storage variable access

§

MsgSender

msg.sender

§

MsgValue

msg.value

§

BlockTimestamp

block.timestamp

§

BlockNumber

block.number

§

ChainId

chain.id

§

TxOrigin

tx.origin

§

Len(Box<VyperExpr>)

len(expr)

§

Convert(Box<VyperExpr>, VyperType)

convert(expr, T)

§

Concat(Vec<VyperExpr>)

concat(a, b, ...)

§

Keccak256(Box<VyperExpr>)

keccak256(expr)

§

Sha256(Box<VyperExpr>)

sha256(expr)

§

Ecrecover(Box<VyperExpr>, Box<VyperExpr>, Box<VyperExpr>, Box<VyperExpr>)

ecrecover(hash, v, r, s)

§

Extract32(Box<VyperExpr>, Box<VyperExpr>)

extract32(expr, start)

§

FieldAccess(Box<VyperExpr>, String)

Field access on a struct: expr.field

§

Index(Box<VyperExpr>, Box<VyperExpr>)

expr[index]

§

Call(String, Vec<VyperExpr>)

Function call: f(args...)

§

ExtCall(String, Box<VyperExpr>, String, Vec<VyperExpr>)

External call: Interface(addr).method(args...)

§

BinOp(String, Box<VyperExpr>, Box<VyperExpr>)

Binary operation: a + b

§

UnaryOp(String, Box<VyperExpr>)

Unary operation: not a, -a

§

IfExpr(Box<VyperExpr>, Box<VyperExpr>, Box<VyperExpr>)

Ternary: value if cond else default

§

StructLit(String, Vec<(String, VyperExpr)>)

Struct literal: MyStruct({field: val, ...})

§

ListLit(Vec<VyperExpr>)

List literal: [a, b, c]

§

Empty(VyperType)

empty(T) — zero value

§

MaxValue(VyperType)

max_value(T)

§

MinValue(VyperType)

min_value(T)

§

Isqrt(Box<VyperExpr>)

isqrt(n)

§

Uint2Str(Box<VyperExpr>)

uint2str(n) (Vyper 0.3+)

§

RawCall

raw_call(addr, data, value=v, gas=g)

§

CreateMinimalProxy(Box<VyperExpr>)

create_minimal_proxy_to(target)

§

CreateCopyOf(Box<VyperExpr>)

create_copy_of(target)

§

CreateFromBlueprint(Box<VyperExpr>, Vec<VyperExpr>)

create_from_blueprint(blueprint, args...)

Trait Implementations§

Source§

impl Clone for VyperExpr

Source§

fn clone(&self) -> VyperExpr

Returns a duplicate 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 VyperExpr

Source§

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

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

impl Display for VyperExpr

Source§

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

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

impl PartialEq for VyperExpr

Source§

fn eq(&self, other: &VyperExpr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for VyperExpr

Auto Trait Implementations§

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.