[−][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
.
Upgrade
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.
Methods
impl<T> ListenerEvent<T>
[src]
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> ListenerEvent<U>
[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 is_upgrade(&self) -> bool
[src]
Returns true
if this is an Upgrade
listener event.
pub fn into_upgrade(self) -> Option<(T, 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.
Trait Implementations
impl<T: PartialEq> PartialEq<ListenerEvent<T>> for ListenerEvent<T>
[src]
fn eq(&self, other: &ListenerEvent<T>) -> bool
[src]
fn ne(&self, other: &ListenerEvent<T>) -> bool
[src]
impl<T: Clone> Clone for ListenerEvent<T>
[src]
fn clone(&self) -> ListenerEvent<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for ListenerEvent<T>
[src]
Auto Trait Implementations
impl<T> Send for ListenerEvent<T> where
T: Send,
T: Send,
impl<T> Sync for ListenerEvent<T> where
T: Sync,
T: Sync,
Blanket Implementations
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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self