tokio_raknet/lib.rs
1//! # tokio-raknet
2//!
3//! A high-performance, asynchronous implementation of the RakNet protocol written in pure Rust.
4//! Built on top of the [Tokio](https://tokio.rs) runtime, it is designed to provide a modern,
5//! ergonomic API for building robust UDP-based networked applications, games, and services.
6//!
7//! ## Features
8//!
9//! * **Fully Asynchronous**: Built with `async`/`await` for high concurrency.
10//! * **Reliability Layers**: Support for Reliable, Unreliable, Ordered, Sequenced, etc.
11//! * **Fragmentation**: Automatic splitting and reassembly of large packets.
12//! * **Simple API**: High-level abstraction resembling `TcpStream` but for UDP/RakNet.
13//!
14//! ## Example: Client
15//!
16//! ```rust,no_run
17//! use tokio_raknet::RaknetStream;
18//! use bytes::Bytes;
19//!
20//! #[tokio::main]
21//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
22//! let mut client = RaknetStream::connect("127.0.0.1:19132".parse()?).await?;
23//! client.send("Hello!").await?;
24//! Ok(())
25//! }
26//! ```
27//!
28//! ## Example: Server
29//!
30//! ```rust,no_run
31//! use tokio_raknet::RaknetListener;
32//!
33//! #[tokio::main]
34//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
35//! let mut listener = RaknetListener::bind("0.0.0.0:19132".parse()?).await?;
36//! while let Some(mut conn) = listener.accept().await {
37//! tokio::spawn(async move {
38//! while let Some(msg) = conn.recv().await {
39//! // Handle packet
40//! }
41//! });
42//! }
43//! Ok(())
44//! }
45//! ```
46#[doc = include_str!("../README.md")]
47pub mod error;
48pub mod protocol;
49pub mod session;
50pub mod transport;
51
52pub use error::RaknetError;
53pub use transport::{RaknetListener, RaknetStream};