pub enum Peer<'a, TTrans: 'a, TInEvent: 'a, TOutEvent: 'a, THandler: 'a, THandlerErr: 'a> where
TTrans: Transport, {
Connected(PeerConnected<'a, TInEvent>),
PendingConnect(PeerPendingConnect<'a, TTrans, TInEvent, TOutEvent, THandler, THandlerErr>),
NotConnected(PeerNotConnected<'a, TTrans, TInEvent, TOutEvent, THandler, THandlerErr>),
LocalNode,
}
State of a peer in the system.
We are connected to this peer.
We are currently attempting to connect to this peer.
We are not connected to this peer at all.
Note: It is however possible that a pending incoming connection is being negotiated
and will connect to this peer, but we don't know it yet.
The requested peer is the local node.
impl<'a, TTrans, TMuxer, TInEvent, TOutEvent, THandler, THandlerErr> Peer<'a, TTrans, TInEvent, TOutEvent, THandler, THandlerErr> where TTrans: Transport<Output = (PeerId, TMuxer)> + Clone, TTrans::Error: Send + 'static, TTrans::Dial: Send + 'static, TMuxer: StreamMuxer + Send + Sync + 'static, TMuxer::OutboundSubstream: Send, TMuxer::Substream: Send, TInEvent: Send + 'static, TOutEvent: Send + 'static, THandler: IntoNodeHandler + Send + 'static, THandler::Handler: NodeHandler<Substream = Substream<TMuxer>, InEvent = TInEvent, OutEvent = TOutEvent, Error = THandlerErr> + Send + 'static, <THandler::Handler as NodeHandler>::OutboundOpenInfo: Send + 'static, THandlerErr: Error + Send + 'static, | [src] |
If we are connected, returns the PeerConnected
.
If a connection is pending, returns the PeerPendingConnect
.
If we are not connected, returns the PeerNotConnected
.
If we're not connected, opens a new connection to this peer using the given multiaddr.
If we reach a peer but the PeerId
doesn't correspond to the one we're expecting, then
the whole connection is immediately closed.
Returns an error if we are LocalNode
.
If we're not connected, calls the function passed as parameter and opens a new connection
using the returned address.
If we reach a peer but the PeerId
doesn't correspond to the one we're expecting, then
the whole connection is immediately closed.
Returns an error if we are LocalNode
.
impl<'a, TTrans, TInEvent, TOutEvent, THandler, THandlerErr> Debug for Peer<'a, TTrans, TInEvent, TOutEvent, THandler, THandlerErr> where TTrans: Transport, | [src] |
Formats the value using the given formatter. Read more
impl<'a, TTrans, TInEvent, TOutEvent, THandler, THandlerErr> !Send for Peer<'a, TTrans, TInEvent, TOutEvent, THandler, THandlerErr> | |
impl<'a, TTrans, TInEvent, TOutEvent, THandler, THandlerErr> !Sync for Peer<'a, TTrans, TInEvent, TOutEvent, THandler, THandlerErr> | |
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static