pub struct MessageOrderer<S, R> { /* private fields */ }
Expand description

Owns any relevant state and provides the functions needed to use the gameplay message protocol with a specific peer who has a matching MessageOrderer.

Provides two sets of send/receive functions: one to pass in received UDP datagrams and get UDP datagrams to send, another for sending and receiving messages of the generic types S and R. The peer’s MessageOrderer must have the same S and R types, except flipped.

Implementations

Creates a new MessageOrderer with the given key. One should be created for each peer, so the client should have one, and the server should have multiple.

Get the next message, if there are any.

Send a message. Note that this only adds the message to this struct’s queue, and needs to be separately sent to the intended recipient over UDP.

Pass in a UDP datagram’s bytes to be handled as a received message, produced on the other end by MessageOrderer::transport_send. The address is just for logging.

peer_id is just used for tagging logs appropriately.

Returns a UDP datagram to send if there’s anything to send. The other end should pass the datagram to MessageOrderer::transport_recv.

peer_id is just used for tagging logs appropriately.

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.