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

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.

Tuple Fields of NewAddress

0: 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.

Tuple Fields of AddressExpired

0: Multiaddr
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.

Tuple Fields of Error

0: TErr

Implementations

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.

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.

Returns true if this is an Upgrade listener event.

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.

Returns true if this is a NewAddress listener event.

Try to turn this listener event into the NewAddress part.

Returns None if the event is not actually a NewAddress, otherwise the address.

Returns true if this is an AddressExpired listener event.

Try to turn this listener event into the AddressExpired part.

Returns None if the event is not actually a AddressExpired, otherwise the address.

Returns true if this is an Error listener event.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.