[][src]Enum libp2p::core::swarm::NetworkBehaviourAction

pub enum NetworkBehaviourAction<TInEvent, TOutEvent> {
    GenerateEvent(TOutEvent),
    DialAddress {
        address: Multiaddr,
    },
    DialPeer {
        peer_id: PeerId,
    },
    SendEvent {
        peer_id: PeerId,
        event: TInEvent,
    },
    ReportObservedAddr {
        address: Multiaddr,
    },
}

An action that a [NetworkBehaviour] can trigger in the Swarm in whose context it is executing.

Variants

GenerateEvent(TOutEvent)

Instructs the Swarm to return an event when it is being polled.

DialAddress

Instructs the swarm to dial the given multiaddress, without a known PeerId.

Fields of DialAddress

address: Multiaddr

The address to dial.

DialPeer

Instructs the swarm to dial a known PeerId.

On success, [NetworkBehaviour::inject_connected] is invoked. On failure, [NetworkBehaviour::inject_dial_failure] is invoked.

Fields of DialPeer

peer_id: PeerId

The peer to try reach.

SendEvent

Instructs the Swarm to send a message to a connected peer.

If the Swarm is connected to the peer, the message is delivered to the remote's protocol handler. If there is no connection to the peer, the message is ignored. To ensure delivery, the NetworkBehaviour must keep track of connected peers.

Fields of SendEvent

peer_id: PeerId

The peer to which to send the message.

event: TInEvent

The message to send.

ReportObservedAddr

Informs the Swarm about a multi-address observed by a remote for the local node.

It is advisable to issue ReportObservedAddr actions at a fixed frequency per node. This way address information will be more accurate over time and individual outliers carry less weight.

Fields of ReportObservedAddr

address: Multiaddr

The observed address of the local node.

Trait Implementations

impl<TInEvent, TOutEvent> Clone for NetworkBehaviourAction<TInEvent, TOutEvent> where
    TInEvent: Clone,
    TOutEvent: Clone
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<TInEvent, TOutEvent> Debug for NetworkBehaviourAction<TInEvent, TOutEvent> where
    TInEvent: Debug,
    TOutEvent: Debug
[src]

Auto Trait Implementations

impl<TInEvent, TOutEvent> Send for NetworkBehaviourAction<TInEvent, TOutEvent> where
    TInEvent: Send,
    TOutEvent: Send

impl<TInEvent, TOutEvent> Sync for NetworkBehaviourAction<TInEvent, TOutEvent> where
    TInEvent: Sync,
    TOutEvent: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Erased for T

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.