Skip to content

Commit d3f1e25

Browse files
committed
Note async versions of event handling within EventsProvider
1 parent 9787b28 commit d3f1e25

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lightning/src/util/events.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,10 @@ pub trait OnionMessageProvider {
14001400
///
14011401
/// Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
14021402
///
1403+
/// Implementations of this trait may also feature an async version of event handling, as shown with
1404+
/// [`ChannelManager::process_pending_events_async`] and
1405+
/// [`ChainMonitor::process_pending_events_async`].
1406+
///
14031407
/// # Requirements
14041408
///
14051409
/// When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
@@ -1426,6 +1430,8 @@ pub trait OnionMessageProvider {
14261430
/// [`handle_event`]: EventHandler::handle_event
14271431
/// [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
14281432
/// [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
1433+
/// [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async
1434+
/// [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async
14291435
pub trait EventsProvider {
14301436
/// Processes any events generated since the last call using the given event handler.
14311437
///
@@ -1434,6 +1440,10 @@ pub trait EventsProvider {
14341440
}
14351441

14361442
/// A trait implemented for objects handling events from [`EventsProvider`].
1443+
///
1444+
/// An async variation also exists for implementations of [`EventsProvider`] that support async
1445+
/// event handling. The async event handler should satisfy the generic bounds: `F:
1446+
/// core::future::Future, H: Fn(Event) -> F`.
14371447
pub trait EventHandler {
14381448
/// Handles the given [`Event`].
14391449
///

0 commit comments

Comments
 (0)