Struct libp2p::core::network::peer::ConnectedPeer [−][src]
pub struct ConnectedPeer<'a, TTrans, THandler> where
TTrans: Transport,
THandler: IntoConnectionHandler, { /* fields omitted */ }
Expand description
The representation of a peer in a Network
to whom at least
one established connection exists. There may also be additional ongoing
dialing attempts to the peer.
Implementations
impl<'a, TTrans, THandler> ConnectedPeer<'a, TTrans, THandler> where
TTrans: Transport,
THandler: IntoConnectionHandler,
<TTrans as Transport>::Error: 'static,
<TTrans as Transport>::Error: Send,
impl<'a, TTrans, THandler> ConnectedPeer<'a, TTrans, THandler> where
TTrans: Transport,
THandler: IntoConnectionHandler,
<TTrans as Transport>::Error: 'static,
<TTrans as Transport>::Error: Send,
pub fn connection(
&mut self,
id: ConnectionId
) -> Option<EstablishedConnection<'_, <<THandler as IntoConnectionHandler>::Handler as ConnectionHandler>::InEvent>>
pub fn connection(
&mut self,
id: ConnectionId
) -> Option<EstablishedConnection<'_, <<THandler as IntoConnectionHandler>::Handler as ConnectionHandler>::InEvent>>
Obtains an established connection to the peer by ID.
The number of established connections to the peer.
Checks whether there is an ongoing dialing attempt to the peer.
Returns true
iff ConnectedPeer::into_dialing
returns Some
.
Converts this peer into a DialingPeer
, if there is an ongoing
dialing attempt, None
otherwise.
pub fn connections(
&mut self
) -> EstablishedConnectionIter<'_, impl Iterator<Item = ConnectionId>, <<THandler as IntoConnectionHandler>::Handler as ConnectionHandler>::InEvent>
pub fn connections(
&mut self
) -> EstablishedConnectionIter<'_, impl Iterator<Item = ConnectionId>, <<THandler as IntoConnectionHandler>::Handler as ConnectionHandler>::InEvent>
Gets an iterator over all established connections to the peer.
pub fn some_connection(
&mut self
) -> EstablishedConnection<'_, <<THandler as IntoConnectionHandler>::Handler as ConnectionHandler>::InEvent>
pub fn some_connection(
&mut self
) -> EstablishedConnection<'_, <<THandler as IntoConnectionHandler>::Handler as ConnectionHandler>::InEvent>
Obtains some established connection to the peer.
Disconnects from the peer, closing all connections.