fix: make event types thread safe (#341)
This commit is contained in:
parent
7ad94c2c5f
commit
04bbd1b424
|
@ -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>;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue