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

A Client connection.

This can only connect to 1 server.

Contains a TCP and UDP connection to the server.

Implementations

Creates a new Client.

Creates a new Client on another thread, passing back a PendingClient. This PendingClient allows you to wait for the client to send the connection message, and for the server to send back the response message.

Gets the config of the client.

Disconnects from the server. You should call this method before dropping the client to let the server know that you intentionally disconnected. The discon_msg allows you to give a reason for the disconnect.

Gets the status of the connection.

Returns whether the connection is open.

Sends a message to the peer.

T must be registered in the [MsgTable].

Gets an iterator for the messages of type T.

Panics

Panics if the type T was not registered. For a non-panicking version, see try_recv().

Gets an iterator for the messages of type T.

Returns None if the type T was not registered.

Receives the messages from the connections. This should be done before calling recv<T>().

When done in a game loop, you should call clear_msgs(), then recv_msgs() before default time. This will clear the messages between frames.

Clears messages from the buffer.

Gets the local address.

Gets the address of the peer.

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.