Crate warqueen

Source
Expand description

§Warqueen

Hobby-scale small networking crate based on Quinn, message based, no async, no blocking.

  • The server and the client are intended to run in a loop.
  • They can poll received messages and events when they want, and send messages when they want.
  • There is a message type for client-to-server messaging, and a message type for server-to-client messaging, and that is all. These two types can be enums to make up for that.
  • Nya :3

Both the client code and server code are supposed to have vaguely the following structure:

let mut networking_stuff = ...;
loop {
    while let Some(event) = poll_event(&mut networking_stuff) {
        handle_event(event);
    }
    handle_other_networking_stuff(&mut networking_stuff);
    // ...
}

Go see the examples, they are very simple, probably the best guide for Warqueen!

Also the README that is displayed on the crates.io page has somewhat of a usage guide.

Things to keep in mind:

  • Do not use, lacks plenty of features.
  • Beware the DisconnectionHandles that are better waited for on the main thread (if you have multiple threads and disconnect from a thread other than the main thread).
  • Good luck out there!

Structs§

ClientNetworking
A connection to a server, from a client’s point of view.
ClientOnServerNetworking
A connection to a client, from a server’s point of view.
DisconnectionHandle
A thingy that allows to make sure that a disconnection has the time to happen properly before process termination.
SendingStateHandle
When a message is sent, it is sent asynchronously over a period. This handle allows to get to know if the message was really properly sent in the end or if something went wrong and what, the information is not available immediately.
ServerListenerNetworking
A piece of server networking that establishes connections to new clients and provides these new clients (in the form of ClientOnServerNetworkings) when asked for.

Enums§

ClientDisconnectionDetails
Details about a disconnection event ClientEvent::Disconnected.
ClientEvent
Returned by ClientNetworking::poll_event_from_server.
ClientOnServerDisconnectionDetails
Details about a disconnection event ClientOnServerEvent::Disconnected.
ClientOnServerEvent
Returned by ClientOnServerNetworking::poll_event_from_client.
ClonelessSending
Allows a sender to clonelessly send the content T as part of a message in the specific situation where:
SendingResult
Was the message successfully sent, or did it fail (and why)?
SendingState
Has the message finished being sent? With what SendingResult?

Traits§

NetReceive
Message type that can be received from the network.
NetSend
Message type that can be sent through the network.

Derive Macros§

NetReceive
Implements the NetReceive trait.
NetSend
Implements the NetSend trait.