Event

Enum Event 

Source
pub enum Event<M: Message> {
    ConnectedTo {
        target: Target,
        result: Result<PeerId>,
    },
    ConnectedFrom {
        peer: PeerId,
        addr: SocketAddr,
        interface: SocketAddr,
    },
    Disconnected {
        peer: PeerId,
        reason: DisconnectReason,
    },
    Message {
        peer: PeerId,
        message: M,
        size: usize,
    },
    NoPeer(PeerId),
    SendBufferFull {
        peer: PeerId,
        message: M,
    },
}

Variants§

§

ConnectedTo

The reactor attempted to connect to a remote peer.

Fields

§target: Target

The remote host that was connected to. This is in the same format it was specified.

§result: Result<PeerId>

The result of the connection attempt. A peer id is returned if successful.

§

ConnectedFrom

The reactor received a connection from a remote peer.

Fields

§peer: PeerId

The peer associated with the event.

§addr: SocketAddr

The address of the remote peer.

§interface: SocketAddr

The address of the local interface that accepted the connection.

§

Disconnected

A peer disconnected.

Fields

§peer: PeerId

The peer associated with the event.

§reason: DisconnectReason

The reason the peer left.

§

Message

A peer produced a message.

Fields

§peer: PeerId

The peer associated with the event.

§message: M

The message received from the peer.

§size: usize

The original wire size of the message before it was decoded.

§

NoPeer(PeerId)

No peer exists with the specified id. Sent when an operation was specified using a peer id that is not present in the reactor.

§

SendBufferFull

The send buffer associated with the peer is full. It means the peer is probably not reading data from the wire in a timely manner.

Fields

§peer: PeerId

The peer associated with the event.

§message: M

The message that could not be sent to the peer.

Trait Implementations§

Source§

impl<M: Debug + Message> Debug for Event<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<M> Freeze for Event<M>
where M: Freeze,

§

impl<M> !RefUnwindSafe for Event<M>

§

impl<M> Send for Event<M>

§

impl<M> Sync for Event<M>

§

impl<M> Unpin for Event<M>
where M: Unpin,

§

impl<M> !UnwindSafe for Event<M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.