Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
Return Pin<Box<...>> instead of Box from closure
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobin C. Harding committed Feb 19, 2020
1 parent ed44ae9 commit 52a4660
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cnd/src/btsieve/ethereum/mod.rs
Expand Up @@ -12,12 +12,12 @@ use crate::{
use anyhow;
use chrono::NaiveDateTime;
use ethbloom::Input;
use futures_core::{compat::Future01CompatExt, Future, FutureExt};
use futureyes_core::{compat::Future01CompatExt, Future};
use genawaiter::{
sync::{Co, Gen},
GeneratorState,
};
use std::collections::HashSet;
use std::{collections::HashSet, pin::Pin};

type Hash = H256;
type Block = crate::ethereum::Block<Transaction>;
Expand Down Expand Up @@ -66,7 +66,7 @@ where
event.topics.clone(),
action,
|transaction| {
Box::new({
Box::pin({
let blockchain_connector = blockchain_connector.clone();
let event = event.clone();
async move {
Expand All @@ -77,7 +77,6 @@ where

Ok(None)
}
.boxed()
})
},
)
Expand Down Expand Up @@ -188,10 +187,8 @@ where
+ Clone,
F: Fn(
Transaction,
) -> Box<
dyn Future<Output = anyhow::Result<Option<(Transaction, TransactionReceipt)>>>
+ Unpin
+ Send,
) -> Pin<
Box<dyn Future<Output = anyhow::Result<Option<(Transaction, TransactionReceipt)>>> + Send>,
>,
{
let mut block_generator = Gen::new({
Expand Down

0 comments on commit 52a4660

Please sign in to comment.