Trait Store

Source
pub trait Store {
    type FromStore: Debug + Send;

    // Required methods
    fn on_swarm_event(&mut self, event: &FromSwarm<'_>);
    fn addresses_of_peer(
        &self,
        peer: &PeerId,
    ) -> Option<impl Iterator<Item = &Multiaddr>>;
    fn poll(&mut self, cx: &mut Context<'_>) -> Option<Event<Self::FromStore>>;
}
Expand description

A store that contains all observed addresses of peers.

Required Associated Types§

Source

type FromStore: Debug + Send

Event generated by the store and emitted to Swarm. Behaviour cannot handle this event.

Required Methods§

Source

fn on_swarm_event(&mut self, event: &FromSwarm<'_>)

How this store handles events from Swarm.

Source

fn addresses_of_peer( &self, peer: &PeerId, ) -> Option<impl Iterator<Item = &Multiaddr>>

Get all stored addresses of the peer.

Source

fn poll(&mut self, cx: &mut Context<'_>) -> Option<Event<Self::FromStore>>

Polls for things that the store should do.
The task should be waked up to emit events to Behaviour and Swarm.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§