pub enum TransportEvent<TUpgr, TErr> {
    NewAddress {
        listener_id: ListenerId,
        listen_addr: Multiaddr,
    },
    AddressExpired {
        listener_id: ListenerId,
        listen_addr: Multiaddr,
    },
    Incoming {
        listener_id: ListenerId,
        upgrade: TUpgr,
        local_addr: Multiaddr,
        send_back_addr: Multiaddr,
    },
    ListenerClosed {
        listener_id: ListenerId,
        reason: Result<(), TErr>,
    },
    ListenerError {
        listener_id: ListenerId,
        error: TErr,
    },
}
Expand description

Event produced by Transports.

Variants§

§

NewAddress

Fields

§listener_id: ListenerId

The listener that is listening on the new address.

§listen_addr: Multiaddr

The new address that is being listened on.

A new address is being listened on.

§

AddressExpired

Fields

§listener_id: ListenerId

The listener that is no longer listening on the address.

§listen_addr: Multiaddr

The new address that is being listened on.

An address is no longer being listened on.

§

Incoming

Fields

§listener_id: ListenerId

The listener that produced the upgrade.

§upgrade: TUpgr

The produced upgrade.

§local_addr: Multiaddr

Local connection address.

§send_back_addr: Multiaddr

Address used to send back data to the incoming client.

A connection is incoming on one of the listeners.

§

ListenerClosed

Fields

§listener_id: ListenerId

The ID of the listener that closed.

§reason: Result<(), TErr>

Reason for the closure. Contains Ok(()) if the stream produced None, or Err if the stream produced an error.

A listener closed.

§

ListenerError

Fields

§listener_id: ListenerId

The ID of the listener that errored.

§error: TErr

The error value.

A listener errored.

The listener will continue to be polled for new events and the event is for informational purposes only.

Implementations§

In case this TransportEvent is an upgrade, apply the given function to the upgrade and produce another transport event based the the function’s result.

In case this TransportEvent is an ListenerError, or ListenerClosed apply the given function to the error and produce another transport event based on the function’s result.

Returns true if this is an Incoming transport event.

Try to turn this transport event into the upgrade parts of the incoming connection.

Returns None if the event is not actually an incoming connection, otherwise the upgrade and the remote address.

Returns true if this is a TransportEvent::NewAddress.

Try to turn this transport event into the new Multiaddr.

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

Returns true if this is an TransportEvent::AddressExpired.

Try to turn this transport event into the expire Multiaddr.

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

Returns true if this is an TransportEvent::ListenerError transport event.

Try to turn this transport event into the listener error.

Returns None if the event is not actually a TransportEvent::ListenerError`, otherwise the error.

Trait Implementations§

Formats the value using the given formatter. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
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.