pub struct EgmPeer { /* private fields */ }
Expand description

Blocking EGM peer for sending and receiving messages over UDP.

Implementations

Wrap an existing UDP socket in a peer.

If you want to use the EgmPeer::recv and EgmPeer::send functions, you should use an already connected socket. Otherwise, you can only use EgmPeer::recv_from and EgmPeer::send_to.

Create an EGM peer on a newly bound UDP socket.

The socket will not be connected to a remote peer, so you can only use EgmPeer::recv_from and EgmPeer::send_to.

Get a shared reference to the inner socket.

Get an exclusive reference to the inner socket.

Consume self and get the inner socket.

Receive a message from the remote address to which the inner socket is connected.

To use this function, you must pass an already connected socket to EgmPeer::new. If the peer was created with an unconnected socket, this function will panic.

Receive a message from any remote address.

Purge all messages from the socket read queue.

Useful to ignore old messages when the socket has been left unpolled for a while.

This will leave the socket in blocking mode when the purging is done.

Send a message to the remote address to which the inner socket is connected.

To use this function, you must pass an already connected socket to EgmPeer::new. If the peer was created with an unconnected socket, this function will panic.

Send a message to the specified address.

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.

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.