Skip to content

Commit

Permalink
Adds From<H160> trait to ValueOrArray<H160>
Browse files Browse the repository at this point in the history
The trait From<H160> for ValueOrArray<H160> was not implemented which
prevented compilation when using
pub fn address<T: Into<ValueOrArray<Address>>>(self, address: T)
for ethers_core::types::Filter.

Fixes: gakonst#1199
  • Loading branch information
CyMule authored and nfranck committed Apr 30, 2022
1 parent 81e7fea commit d8cd760
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ethers-core/src/types/log.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Adapted from https://github.com/tomusdrw/rust-web3/blob/master/src/types/log.rs
use crate::{
types::{Address, BlockNumber, Bytes, H256, U256, U64},
types::{Address, BlockNumber, Bytes, H160, H256, U256, U64},
utils::keccak256,
};
use serde::{
Expand Down Expand Up @@ -360,6 +360,12 @@ pub enum ValueOrArray<T> {

// TODO: Implement more common types - or adjust this to work with all Tokenizable items

impl From<H160> for ValueOrArray<H160> {
fn from(src: H160) -> Self {
ValueOrArray::Value(src)
}
}

impl From<H256> for ValueOrArray<H256> {
fn from(src: H256) -> Self {
ValueOrArray::Value(src)
Expand Down

0 comments on commit d8cd760

Please sign in to comment.