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

Action to perform.

Variants

GenerateEvent(TOutEvent)

Generate an event for the outside.

DialAddress

Fields

address: Multiaddr

The address to dial.

Instructs the swarm to dial the given multiaddress without any expectation of a peer id.

DialPeer

Fields

peer_id: PeerId

The peer to try reach.

Instructs the swarm to try reach the given peer.

SendEvent

Fields

peer_id: PeerId

The peer which to send the message to.

event: TInEvent

Event to send to the peer.

If we’re connected to the given peer, sends a message to the protocol handler.

If we’re not connected to this peer, does nothing. If necessary, the implementation of NetworkBehaviour is supposed to track which peers we are connected to.

ReportObservedAddr

Fields

address: Multiaddr

The address we’re being observed as.

Reports that a remote observes us as this address.

The swarm will pass this address through the transport’s NAT traversal.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.