warqueen/
lib.rs

1//! # Warqueen
2//!
3//! Hobby-scale small networking crate based on [Quinn](https://crates.io/crates/quinn),
4//! message based, no async, no blocking.
5//!
6//! - The server and the client are intended to run in a loop.
7//! - They can poll received messages and events when they want,
8//!   and send messages when they want.
9//! - There is a message type for client-to-server messaging,
10//!   and a message type for server-to-client messaging, and that is all.
11//!   These two types can be enums to make up for that.
12//! - Nya :3
13//!
14//! Both the client code and server code are supposed to have vaguely the following structure:
15//! ```ignore
16//! let mut networking_stuff = ...;
17//! loop {
18//!     while let Some(event) = poll_event(&mut networking_stuff) {
19//!         handle_event(event);
20//!     }
21//!     handle_other_networking_stuff(&mut networking_stuff);
22//!     // ...
23//! }
24//! ```
25//!
26//! Go see the examples, they are very simple, probably the best guide for Warqueen!
27//!
28//! Also the [README](https://github.com/anima-libera/warqueen/blob/main/README.md)
29//! that is displayed on the [crates.io page](https://crates.io/crates/warqueen)
30//! has somewhat of a usage guide.
31//!
32//! Things to keep in mind:
33//! - Do not use, lacks plenty of features.
34//! - Beware the [`DisconnectionHandle`]s that are better waited for on the main thread
35//!   (if you have multiple threads and disconnect from a thread other than the main thread).
36//! - Good luck out there!
37
38mod async_runtime;
39mod client;
40mod cloneless;
41mod disconnection;
42mod net_traits;
43mod receiving;
44mod sending;
45mod server;
46
47// Opt-out derive macros.
48#[cfg(feature = "derive")]
49pub use warqueen_derive::{NetReceive, NetSend};
50
51pub use client::{ClientDisconnectionDetails, ClientEvent, ClientNetworking};
52pub use cloneless::ClonelessSending;
53pub use disconnection::DisconnectionHandle;
54pub use net_traits::{NetReceive, NetSend};
55pub use sending::{SendingResult, SendingState, SendingStateHandle};
56pub use server::{
57    ClientOnServerDisconnectionDetails, ClientOnServerEvent, ClientOnServerNetworking,
58    ServerListenerNetworking,
59};