Derive Macro ethers_contract::EthDisplay

source ·
#[derive(EthDisplay)]
{
    // Attributes available to this derive:
    #[ethdisplay]
}
Available on crate feature abigen only.
Expand description

Derives fmt::Display trait and generates a convenient format for all the underlying primitive types/tokens.

The fields of the structure are formatted comma separated, like self.0, self.1, self.2,...

Example

use ethers_contract::{EthDisplay, EthAbiType};
use ethers_core::types::*;

#[derive(Debug, Clone, EthAbiType, EthDisplay)]
struct MyStruct {
    addr: Address,
    old_value: String,
    new_value: String,
    h: H256,
    arr_u8: [u8; 32],
    arr_u16: [u16; 32],
    v: Vec<u8>,
}
let val = MyStruct {..};
format!("{}", val);