Encode

Trait Encode 

Source
pub trait Encode<const N: usize>: Sized {
    // Required method
    fn tokenize(&self) -> [Token; N];

    // Provided methods
    fn encode(&self) -> EncodeCell<Self> { ... }
    fn keccak256(&self) -> KeccakHash { ... }
    fn signable_keccak256(&self) -> KeccakHash { ... }
}
Expand description

Contains a method to encode data to a format compatible with Ethereum.

Required Methods§

Source

fn tokenize(&self) -> [Token; N]

Encodes a struct into a sequence of ABI Token instances.

Provided Methods§

Source

fn encode(&self) -> EncodeCell<Self>

Returns the encoded Token instances, in a type-safe enclosure.

Source

fn keccak256(&self) -> KeccakHash

Encodes a slice of Token instances, and returns the keccak hash of the encoded string.

Source

fn signable_keccak256(&self) -> KeccakHash

Encodes a slice of Token instances, and returns the keccak hash of the encoded string appended to an Ethereum signature header. This can then be signed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Encode<1> for ValidatorSetArgs

Source§

fn tokenize(&self) -> [Token; 1]

Source§

impl<const N: usize> Encode<N> for [Token; N]

Source§

fn tokenize(&self) -> [Token; N]

Implementors§