Enum msgpacknet::Event [] [src]

pub enum Event<M: Message, N: NodeId, I: InitMessage> {
    Message(N, M),
    ConnectionRequest(ConnectionRequest<M, N, I>),
    Connected(N),
    Disconnected(N),
    Closing,
    Closed,
}

The enum used for events

Variants

Message

A received message

This event is emitted whenever a new message is received from any connection.

ConnectionRequest

An incoming connection request

This event is emitted whenever a new incoming connection is established and the initialization message has been received. To accept the connection accept(...) has to be called.

Note: The connection has not been registered in the node and can't be used to send any messages yet.

Connected

A new estasblished connection

This event is emitted whenever a new connection has been established and can be used to send messages.

Disconnected

A lost connection

This event is emitted whenever a connection has been lost and can no longer be used to send messages.

Note: This event is emitted after the connection has been closed and unregistered, so it can't be used to send final messages on that connection.

Note 2: This event will not be emitted if a duplicate connection to the same node is closed.

Closing

Node closing

This event is emitted whenever the node is shutting down. At this time, all connections are still active and can be used to send final messages.

Closed

Node closed

This event is emitted whenever the node has shut down. At this time, all connections have been closed and no final messages can be sent.

Trait Implementations

Derived Implementations

impl<M: Debug + Message, N: Debug + NodeId, I: Debug + InitMessage> Debug for Event<M, N, I>

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl<M: PartialEq + Message, N: PartialEq + NodeId, I: PartialEq + InitMessage> PartialEq for Event<M, N, I>

fn eq(&self, __arg_0: &Event<M, N, I>) -> bool

fn ne(&self, __arg_0: &Event<M, N, I>) -> bool