Derive Macro ethers_contract::EthDisplay
source · #[derive(EthDisplay)]
{
// Attributes available to this derive:
#[ethdisplay]
}
Available on crate feature
abigen
only.Expand description
Derives the Display
trait on structs by formatting each field based on its Ethereum type.
The final output is a comma separated list of the struct’s fields, formatted as follows:
self.0, self.1, self.2,...
§Examples
use ethers_contract_derive::{EthAbiType, EthDisplay};
use ethers_core::types::*;
#[derive(Clone, Default, 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 s = MyStruct::default();
assert!(!format!("{s}").is_empty());