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.

Accepted(TOutput)

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]

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]

impl<TOutput: Debug> Debug for ListenerEvent<TOutput>[src]

Auto Trait Implementations

impl<TOutput> RefUnwindSafe for ListenerEvent<TOutput> where
    TOutput: RefUnwindSafe

impl<TOutput> Send for ListenerEvent<TOutput> where
    TOutput: Send

impl<TOutput> Sync for ListenerEvent<TOutput> where
    TOutput: Sync

impl<TOutput> Unpin for ListenerEvent<TOutput> where
    TOutput: Unpin

impl<TOutput> UnwindSafe for ListenerEvent<TOutput> where
    TOutput: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,