Skip to content

Commit 4ec5612

Browse files
committed
f! take events by value
1 parent 94b553d commit 4ec5612

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

lightning-invoice/src/payment.rs

+3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
//! # struct FakeEventProvider {}
5353
//! # impl EventsProvider for FakeEventProvider {
5454
//! # fn process_pending_events<H: Deref>(&self, handler: H) where H::Target: EventHandler {}
55+
//! # fn process_pending_events_async<'a, H: Deref + 'a>(
56+
//! # &'a self, handler: H
57+
//! # ) -> Pin<Box<dyn StdFuture<Output = ()> + 'a>> where H::Target: AsyncEventHandler {}
5558
//! # }
5659
//! #
5760
//! # struct FakePayer {}

lightning/src/chain/chainmonitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ impl<ChannelSigner: Sign, C: Deref, T: Deref, F: Deref, L: Deref, P: Deref> even
763763
pending_events.append(&mut monitor_state.monitor.get_and_clear_pending_events());
764764
}
765765
for event in pending_events.drain(..) {
766-
handler.handle_event_async(&event).await;
766+
handler.handle_event_async(event).await;
767767
}
768768
})
769769
}

lightning/src/ln/channelmanager.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5669,7 +5669,7 @@ where
56695669
}
56705670

56715671
for event in pending_events.drain(..) {
5672-
handler.handle_event_async(&event).await;
5672+
handler.handle_event_async(event).await;
56735673
}
56745674

56755675
if result == NotifyOption::DoPersist {

lightning/src/util/events.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1407,19 +1407,19 @@ pub trait AsyncEventHandler {
14071407
/// Handles the given [`Event`] asynchronously.
14081408
///
14091409
/// See [`EventsProvider`] for details that must be considered when implementing this method.
1410-
fn handle_event_async<'a>(&'a self, event: &'a Event) -> Pin<Box<dyn StdFuture<Output = ()> + 'a>>;
1410+
fn handle_event_async<'a>(&'a self, event: Event) -> Pin<Box<dyn StdFuture<Output = ()> + 'a>>;
14111411
}
14121412

1413-
impl<F> AsyncEventHandler for F where F: Fn(&Event) {
1414-
fn handle_event_async<'a>(&'a self, event: &'a Event) -> Pin<Box<dyn StdFuture<Output = ()> + 'a>> {
1413+
impl<F> AsyncEventHandler for F where F: Fn(Event) {
1414+
fn handle_event_async<'a>(&'a self, event: Event) -> Pin<Box<dyn StdFuture<Output = ()> + 'a>> {
14151415
Box::pin(async move {
14161416
self(event);
14171417
})
14181418
}
14191419
}
14201420

14211421
impl<T: AsyncEventHandler> AsyncEventHandler for Arc<T> {
1422-
fn handle_event_async<'a>(&'a self, event: &'a Event) -> Pin<Box<dyn StdFuture<Output = ()> + 'a>> {
1422+
fn handle_event_async<'a>(&'a self, event: Event) -> Pin<Box<dyn StdFuture<Output = ()> + 'a>> {
14231423
Box::pin(async move {
14241424
self.deref().handle_event_async(event).await
14251425
})

0 commit comments

Comments
 (0)