| Crates.io | silent |
| lib.rs | silent |
| version | 2.12.0 |
| created_at | 2023-04-28 02:05:47.317347+00 |
| updated_at | 2025-12-11 06:39:32.442939+00 |
| description | Silent Web Framework |
| homepage | https://github.com/silent-rs/silent |
| repository | https://github.com/silent-rs/silent |
| max_upload_size | |
| id | 851111 |
| size | 627,746 |
Silent 是一个简单的基于Hyper的Web框架,它的目标是提供一个简单的、高效的、易于使用的Web框架。
提供与协议无关的通用网络服务器,支持 TCP、Unix Socket 等多种监听方式,并内置连接限流和优雅关停功能。
use silent::NetServer;
use std::time::Duration;
#[tokio::main]
async fn main() {
NetServer::new()
.bind("127.0.0.1:8080".parse().unwrap())
.with_rate_limiter(10, Duration::from_millis(10), Duration::from_secs(2))
.with_shutdown(Duration::from_secs(5))
.serve(|mut stream, peer| async move {
println!("Connection from: {}", peer);
// 处理连接...
Ok(())
})
.await;
}
ConnectionService trait 支持任意应用层协议add make_password and verify_password function
add make_password and verify_password function
re-export aes/aes_gcm
re-export rsa
use silent::Configs;
let mut configs = Configs::default ();
configs.insert(1i32);
async fn call(req: Request) -> Result<i32> {
let num = req.configs().get::<i32>().unwrap();
Ok(*num)
}