Enum libp2p_core::swarm::NetworkBehaviourAction
source · 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: MultiaddrThe address to dial.
Instructs the swarm to dial the given multiaddress without any expectation of a peer id.
DialPeer
Fields
peer_id: PeerIdThe peer to try reach.
Instructs the swarm to try reach the given peer.
SendEvent
Fields
peer_id: PeerIdThe peer which to send the message to.
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: MultiaddrThe 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
sourceimpl<TInEvent: Clone, TOutEvent: Clone> Clone for NetworkBehaviourAction<TInEvent, TOutEvent>
impl<TInEvent: Clone, TOutEvent: Clone> Clone for NetworkBehaviourAction<TInEvent, TOutEvent>
sourcefn clone(&self) -> NetworkBehaviourAction<TInEvent, TOutEvent>
fn clone(&self) -> NetworkBehaviourAction<TInEvent, TOutEvent>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations
impl<TInEvent, TOutEvent> RefUnwindSafe for NetworkBehaviourAction<TInEvent, TOutEvent>where
TInEvent: RefUnwindSafe,
TOutEvent: RefUnwindSafe,
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,
impl<TInEvent, TOutEvent> Unpin for NetworkBehaviourAction<TInEvent, TOutEvent>where
TInEvent: Unpin,
TOutEvent: Unpin,
impl<TInEvent, TOutEvent> UnwindSafe for NetworkBehaviourAction<TInEvent, TOutEvent>where
TInEvent: UnwindSafe,
TOutEvent: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more