[−][src]Enum libp2p_core::transport::ListenerEvent
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
.
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.
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.
Methods
impl<TUpgr, TErr> ListenerEvent<TUpgr, TErr>
[src]
pub fn map<U>(self, f: impl FnOnce(TUpgr) -> U) -> ListenerEvent<U, TErr>
[src]
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.
pub fn map_err<U>(self, f: impl FnOnce(TErr) -> U) -> ListenerEvent<TUpgr, U>
[src]
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.
pub fn is_upgrade(&self) -> bool
[src]
Returns true
if this is an Upgrade
listener event.
pub fn into_upgrade(self) -> Option<(TUpgr, Multiaddr)>
[src]
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.
pub fn is_new_address(&self) -> bool
[src]
Returns true
if this is a NewAddress
listener event.
pub fn into_new_address(self) -> Option<Multiaddr>
[src]
Try to turn this listener event into the NewAddress
part.
Returns None
if the event is not actually a NewAddress
,
otherwise the address.
pub fn is_address_expired(&self) -> bool
[src]
Returns true
if this is an AddressExpired
listener event.
pub fn into_address_expired(self) -> Option<Multiaddr>
[src]
Try to turn this listener event into the AddressExpired
part.
Returns None
if the event is not actually a AddressExpired
,
otherwise the address.
pub fn is_error(&self) -> bool
[src]
Returns true
if this is an Error
listener event.
pub fn into_error(self) -> Option<TErr>
[src]
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: Clone, TErr: Clone> Clone for ListenerEvent<TUpgr, TErr>
[src]
fn clone(&self) -> ListenerEvent<TUpgr, TErr>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<TUpgr: Debug, TErr: Debug> Debug for ListenerEvent<TUpgr, TErr>
[src]
impl<TUpgr: PartialEq, TErr: PartialEq> PartialEq<ListenerEvent<TUpgr, TErr>> for ListenerEvent<TUpgr, TErr>
[src]
fn eq(&self, other: &ListenerEvent<TUpgr, TErr>) -> bool
[src]
fn ne(&self, other: &ListenerEvent<TUpgr, TErr>) -> bool
[src]
impl<TUpgr, TErr> StructuralPartialEq for ListenerEvent<TUpgr, TErr>
[src]
Auto Trait Implementations
impl<TUpgr, TErr> RefUnwindSafe for ListenerEvent<TUpgr, TErr> where
TErr: RefUnwindSafe,
TUpgr: RefUnwindSafe,
TErr: RefUnwindSafe,
TUpgr: RefUnwindSafe,
impl<TUpgr, TErr> Send for ListenerEvent<TUpgr, TErr> where
TErr: Send,
TUpgr: Send,
TErr: Send,
TUpgr: Send,
impl<TUpgr, TErr> Sync for ListenerEvent<TUpgr, TErr> where
TErr: Sync,
TUpgr: Sync,
TErr: Sync,
TUpgr: Sync,
impl<TUpgr, TErr> Unpin for ListenerEvent<TUpgr, TErr> where
TErr: Unpin,
TUpgr: Unpin,
TErr: Unpin,
TUpgr: Unpin,
impl<TUpgr, TErr> UnwindSafe for ListenerEvent<TUpgr, TErr> where
TErr: UnwindSafe,
TUpgr: UnwindSafe,
TErr: UnwindSafe,
TUpgr: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,