| Crates.io | maestro-rs |
| lib.rs | maestro-rs |
| version | 0.2.0 |
| created_at | 2025-11-19 21:35:42.005938+00 |
| updated_at | 2025-11-25 23:14:09.468027+00 |
| description | A lightweight, fast, and ergonomic framework for building TCP & UDP servers in Rust with zero boilerplate. |
| homepage | |
| repository | https://github.com/0x536b796ec3b578/maestro |
| max_upload_size | |
| id | 1940804 |
| size | 66,862 |
A lightweight, fast, and ergonomic framework for building TCP & UDP servers in Rust with zero boilerplate.
Maestro is a networking library that enables you to build high-performance concurrent TCP and UDP servers in Rust. By implementing just two lightweight traits, you can focus on your application's core logic while Maestro handles the network orchestration:
TcpHandlerUdpHandlerIn other words: You compose the logic. Maestro conducts the orchestra.
use maestro_rs::{NetworkInterface, Result, Supervisor, TcpHandler, async_trait};
use std::{net::SocketAddr, str::FromStr};
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
net::TcpStream,
};
struct MyTcpService;
#[async_trait]
impl TcpHandler for MyTcpService {
fn name(&self) -> &'static str {
"My TCP Service"
}
fn port(&self) -> u16 {
8080
}
async fn on_connection(&self, stream: TcpStream, peer: &SocketAddr) {
// Handle the connection here
}
}
use maestro_rs::{NetworkInterface, Result, Supervisor, UdpHandler, async_trait};
use std::{net::SocketAddr, str::FromStr, sync::Arc};
use tokio::net::UdpSocket;
struct MyUdpService;
#[async_trait]
impl UdpHandler for MyUdpService {
fn name(&self) -> &'static str {
"My UDP Service"
}
fn port(&self) -> u16 {
5353
}
async fn on_packet(&self, data: &[u8], socket: Arc<UdpSocket>, peer: &SocketAddr) {
// Process the packet here
}
}
Supervisoruse maestro_rs::{Supervisor, NetworkInterface, Result};
use std::str::FromStr;
#[tokio::main]
async fn main() -> Result<()> {
let network_interface = NetworkInterface::from_str("lo")?;
let mut supervisor = Supervisor::new(network_interface);
supervisor.add(MyUdpService);
supervisor.add(MyTcpService);
supervisor.run().await?;
Ok(())
}
Run the following Cargo command in your project directory:
cargo add maestro-rs
Or add the following line to your Cargo.toml:
maestro-rs = "0.2.0"
We welcome contributions! Here are some good areas to get involved:
Before submitting a PR, please ensure that your changes are properly formatted by running:
cargo fmt
cargo clippy
Author: Skynõx
If you'd like to support the project, you can donate via the following addresses:
| Bitcoin | bc1q87r2z8szxwqt538edzw5gl397c9v3hzxwjw82h |
|---|---|
| Ethereum | 0xe277049067F72E89326c2C0D11333531d5BbB78B |
Maestro - one who conducts. Just like its name, this library orchestrates the networking layer so your application can focus on the melody of your logic.