Enum tet_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),
}

Event produced by Transport::Listeners.

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

upgrade: TUpgr

The upgrade.

local_addr: Multiaddr

The local address which produced this upgrade.

remote_addr: Multiaddr

The remote address which produced this upgrade.

AddressExpired(Multiaddr)

A Multiaddr is no longer used for listening.

Error(TErr)

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

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]

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]

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

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

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>,