Parameter

Enum Parameter 

Source
pub enum Parameter {
    Address(H256),
    Bool(H256),
    Int(H256, usize),
    Uint(H256, usize),
    String(Vec<u8>),
    Bytes(Vec<u8>),
    FixedBytes(Vec<u8>),
    Array(Vec<Parameter>),
    FixedArray(Vec<Parameter>),
    Tuple(Vec<Parameter>),
}
Expand description

An ABI function parameter type enclosing the underlying numeric data bytes.

Variants§

§

Address(H256)

§

Bool(H256)

§

Int(H256, usize)

§

Uint(H256, usize)

§

String(Vec<u8>)

§

Bytes(Vec<u8>)

§

FixedBytes(Vec<u8>)

§

Array(Vec<Parameter>)

§

FixedArray(Vec<Parameter>)

§

Tuple(Vec<Parameter>)

Implementations§

Source§

impl Parameter

Source

pub fn new_int(bytes: [u8; 32], signed: bool) -> Self

Source

pub fn new_fixed_bytes(bytes: &[u8]) -> Self

Creates a new FixedBytes parameter.

Source

pub fn new_bytes(bytes: &[u8]) -> Self

Creates a new Bytes parameter.

Source§

impl Parameter

Source

pub fn static_encode(&self) -> Vec<u8>

Encodes strictly the data part of the underlying type.

It will not check whether the parameter is dynamic or not, it simply encodes the enclosed data in place. For some types, it first writes the number of elements of the data in bytes. For further info, check the Solidity contract ABI specification.

Source

pub fn is_dynamic(&self) -> bool

Recursively checks wether a given parameter is dynamic.

For example, a Tuple can be dynamic if any of its contained types are dynamic. Additionally, a FixedArray is static if it contains values with static type and dynamic otherwise.

Source

pub fn decode(parameter_type: &ParameterType, raw_bytes: &[u8]) -> (Self, usize)

Trait Implementations§

Source§

impl Clone for Parameter

Source§

fn clone(&self) -> Parameter

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 Display for Parameter

Source§

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

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

impl From<&str> for Parameter

Source§

fn from(input: &str) -> Self

Converts to this type from the input type.
Source§

impl From<EthereumType<16, false>> for Parameter

Source§

fn from(input: U128) -> Self

Converts to this type from the input type.
Source§

impl From<EthereumType<20, true>> for Parameter

Source§

fn from(input: Address) -> Self

Converts to this type from the input type.
Source§

impl From<EthereumType<32, false>> for Parameter

Source§

fn from(input: U256) -> Self

Converts to this type from the input type.
Source§

impl From<EthereumType<8, false>> for Parameter

Source§

fn from(input: U64) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Parameter

Source§

fn from(input: bool) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Parameter

Source§

fn from(input: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Parameter

Source§

fn from(input: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Parameter

Source§

fn from(input: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Parameter

Source§

fn from(input: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Parameter

Source§

fn from(input: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Parameter

Source§

fn from(input: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Parameter

Source§

fn from(input: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Parameter

Source§

fn from(input: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Parameter

Source§

fn from(input: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Parameter

Source§

fn from(input: u8) -> Self

Converts to this type from the input type.

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.