pub trait ValueExt {
// Required methods
fn to_u64(&self) -> Result<u64>;
fn to_big_int(&self) -> Result<BigInt>;
fn to_str(&self) -> Result<&str>;
}Expand description
Decoding helpers for Ethereum-encoded serde_json::Value results.
Implemented for serde_json::Value, so any RPC call result can be decoded
in place: rpc.call(...).await?.to_u64()?.
Required Methods§
Sourcefn to_u64(&self) -> Result<u64>
fn to_u64(&self) -> Result<u64>
Decodes an Ethereum quantity as a u64. Accepts a hex/decimal JSON
string (e.g. "0x1b4") or a JSON number.
Sourcefn to_big_int(&self) -> Result<BigInt>
fn to_big_int(&self) -> Result<BigInt>
Decodes an Ethereum quantity as a BigInt. Accepts a hex/decimal JSON
string or a JSON number.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".