Enum libp2p_core::transport::ListenerEvent [−][src]
pub enum ListenerEvent<TUpgr, TErr> {
NewAddress(Multiaddr),
Upgrade {
upgrade: TUpgr,
local_addr: Multiaddr,
remote_addr: Multiaddr,
},
AddressExpired(Multiaddr),
Error(TErr),
}
Expand description
Event produced by Transport::Listener
s.
Transports are expected to produce Upgrade
events only for
listen addresses which have previously been announced via
a NewAddress
event and which have not been invalidated by
an AddressExpired
event yet.
Variants
NewAddress(Multiaddr)
The transport is listening on a new additional Multiaddr
.
Tuple Fields of NewAddress
0: Multiaddr
An upgrade, consisting of the upgrade future, the listener address and the remote address.
Fields of Upgrade
AddressExpired(Multiaddr)
A Multiaddr
is no longer used for listening.
Tuple Fields of AddressExpired
0: Multiaddr
A non-fatal error has happened on the listener.
This event should be generated in order to notify the user that something wrong has happened. The listener, however, continues to run.
Implementations
In case this ListenerEvent
is an upgrade, apply the given function
to the upgrade and multiaddress and produce another listener event
based the the function’s result.
In case this ListenerEvent
is an Error
,
apply the given function to the error and produce another listener event based on the
function’s result.
Returns true
if this is an Upgrade
listener event.
Try to turn this listener event into upgrade parts.
Returns None
if the event is not actually an upgrade,
otherwise the upgrade and the remote address.
Returns true
if this is a NewAddress
listener event.
Try to turn this listener event into the NewAddress
part.
Returns None
if the event is not actually a NewAddress
,
otherwise the address.
Returns true
if this is an AddressExpired
listener event.
Try to turn this listener event into the AddressExpired
part.
Returns None
if the event is not actually a AddressExpired
,
otherwise the address.
Try to turn this listener event into the Error
part.
Returns None
if the event is not actually a Error
,
otherwise the error.
Trait Implementations
impl<TUpgr: PartialEq, TErr: PartialEq> PartialEq<ListenerEvent<TUpgr, TErr>> for ListenerEvent<TUpgr, TErr>
impl<TUpgr: PartialEq, TErr: PartialEq> PartialEq<ListenerEvent<TUpgr, TErr>> for ListenerEvent<TUpgr, TErr>
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<TUpgr, TErr> RefUnwindSafe for ListenerEvent<TUpgr, TErr> where
TErr: RefUnwindSafe,
TUpgr: RefUnwindSafe,
impl<TUpgr, TErr> Send for ListenerEvent<TUpgr, TErr> where
TErr: Send,
TUpgr: Send,
impl<TUpgr, TErr> Sync for ListenerEvent<TUpgr, TErr> where
TErr: Sync,
TUpgr: Sync,
impl<TUpgr, TErr> Unpin for ListenerEvent<TUpgr, TErr> where
TErr: Unpin,
TUpgr: Unpin,
impl<TUpgr, TErr> UnwindSafe for ListenerEvent<TUpgr, TErr> where
TErr: UnwindSafe,
TUpgr: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more