Trait NetworkEventListenerProvider
pub trait NetworkEventListenerProvider: NetworkPeersEvents {
type Primitives: NetworkPrimitives;
// Required methods
fn event_listener(
&self,
) -> EventStream<NetworkEvent<PeerRequest<Self::Primitives>>>;
fn discovery_listener(&self) -> UnboundedReceiverStream<DiscoveryEvent>;
}
Expand description
Provides event subscription for the network.
Required Associated Types§
type Primitives: NetworkPrimitives
type Primitives: NetworkPrimitives
The primitive types to use in the PeerRequest
used in the stream.
Required Methods§
fn event_listener(
&self,
) -> EventStream<NetworkEvent<PeerRequest<Self::Primitives>>>
fn event_listener( &self, ) -> EventStream<NetworkEvent<PeerRequest<Self::Primitives>>>
Creates a new NetworkEvent
listener channel.
fn discovery_listener(&self) -> UnboundedReceiverStream<DiscoveryEvent>
fn discovery_listener(&self) -> UnboundedReceiverStream<DiscoveryEvent>
Returns a new DiscoveryEvent
stream.
This stream yields DiscoveryEvent
s for each peer that is discovered.