fix: make event types thread safe (#341)

This commit is contained in:
Georgios Konstantopoulos 2021-07-13 14:13:12 +03:00 committed by GitHub
parent 7ad94c2c5f
commit 04bbd1b424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ use std::borrow::Cow;
use std::marker::PhantomData; use std::marker::PhantomData;
/// A trait for implementing event bindings /// A trait for implementing event bindings
pub trait EthEvent: Detokenize { pub trait EthEvent: Detokenize + Send + Sync {
/// The name of the event this type represents /// The name of the event this type represents
fn name() -> Cow<'static, str>; fn name() -> Cow<'static, str>;

View File

@ -3,7 +3,7 @@ use ethers_core::abi::Error;
use ethers_core::abi::RawLog; use ethers_core::abi::RawLog;
/// A trait for types (events) that can be decoded from a `RawLog` /// A trait for types (events) that can be decoded from a `RawLog`
pub trait EthLogDecode { pub trait EthLogDecode: Send + Sync {
/// decode from a `RawLog` /// decode from a `RawLog`
fn decode_log(log: &RawLog) -> Result<Self, Error> fn decode_log(log: &RawLog) -> Result<Self, Error>
where where

View File

@ -4,7 +4,7 @@ use pin_project::pin_project;
use std::pin::Pin; use std::pin::Pin;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
type MapEvent<'a, R, E> = Box<dyn Fn(Log) -> Result<R, E> + 'a>; type MapEvent<'a, R, E> = Box<dyn Fn(Log) -> Result<R, E> + 'a + Send + Sync>;
#[pin_project] #[pin_project]
/// Generic wrapper around Log streams, mapping their content to a specific /// Generic wrapper around Log streams, mapping their content to a specific