Struct msgpacknet::ConnectionRequest [] [src]

pub struct ConnectionRequest<M: Message, N: NodeId, I: InitMessage> {
    // some fields omitted
}

The request to establish a connection

This request is created for all new connections before they can be registered and used for message exchange. The request contains the initialization message that has been received from the remote side.

To accept the request, the method accept() has to be called.

To reject the connection request, the object can be dropped or the method reject() can be called.

Methods

impl<M: Message, N: NodeId, I: InitMessage> ConnectionRequest<M, N, I>

fn init_message(&self) -> &I

The initialization message received from the remote side.

fn node_id(&self) -> &N

The node id received from the remote side.

fn accept(self)

Accept the connection

When this method is called, the connection is registered and is usable for message exchange afterwards.

fn reject(self)

Reject the connection

Trait Implementations

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

fn eq(&self, other: &Self) -> bool

fn ne(&self, other: &Rhs) -> bool

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

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