Enum libp2prs_core::transport::ListenerEvent [−][src]
pub enum ListenerEvent<TOutput> { AddressAdded(Multiaddr), AddressDeleted(Multiaddr), Accepted(TOutput), }
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
AddressAdded(Multiaddr)
A new additional Multiaddr
has been added.
AddressDeleted(Multiaddr)
A Multiaddr
is no longer existent.
A TOutput has been accepted.
Implementations
impl<TOutput> ListenerEvent<TOutput>
[src]
pub fn map<U>(
self,
f: impl FnOnce(TOutput) -> Result<U, TransportError>
) -> Result<ListenerEvent<U>, TransportError>
[src]
self,
f: impl FnOnce(TOutput) -> Result<U, TransportError>
) -> Result<ListenerEvent<U>, TransportError>
In case this ListenerEvent
is an Accpeted(), apply the given function
produce another listener event based the the function’s result.
pub fn is_address_added(&self) -> bool
[src]
Returns true
if this is a AddressAdded
listener event.
pub fn into_new_address(self) -> Option<Multiaddr>
[src]
Try to turn this listener event into the AddressAdded
part.
Returns None
if the event is not actually a AddressAdded
,
otherwise the address.
pub fn is_address_deleted(&self) -> bool
[src]
Returns true
if this is an AddressExpired
listener event.
pub fn into_address_deleted(self) -> Option<Multiaddr>
[src]
Try to turn this listener event into the AddressDeleted
part.
Returns None
if the event is not actually a AddressDeleted
,
otherwise the address.
Trait Implementations
impl<TOutput: Clone> Clone for ListenerEvent<TOutput>
[src]
fn clone(&self) -> ListenerEvent<TOutput>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<TOutput: Debug> Debug for ListenerEvent<TOutput>
[src]
Auto Trait Implementations
impl<TOutput> RefUnwindSafe for ListenerEvent<TOutput> where
TOutput: RefUnwindSafe,
TOutput: RefUnwindSafe,
impl<TOutput> Send for ListenerEvent<TOutput> where
TOutput: Send,
TOutput: Send,
impl<TOutput> Sync for ListenerEvent<TOutput> where
TOutput: Sync,
TOutput: Sync,
impl<TOutput> Unpin for ListenerEvent<TOutput> where
TOutput: Unpin,
TOutput: Unpin,
impl<TOutput> UnwindSafe for ListenerEvent<TOutput> where
TOutput: UnwindSafe,
TOutput: 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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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.
pub 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>,