| Crates.io | sark |
| lib.rs | sark |
| version | 0.1.1 |
| created_at | 2025-04-01 05:37:18.50295+00 |
| updated_at | 2025-04-01 05:39:30.174071+00 |
| description | Simple Asynchronous Rust webKit |
| homepage | |
| repository | https://github.com/inq/sark |
| max_upload_size | |
| id | 1614441 |
| size | 45,121 |
Static Asynchronous Rust web frameKit
SARK is a lightweight, single-threaded asynchronous web framework for Rust, built on top of the monoio runtime. It uses Rust's type system to provide fully static routing with zero dynamic dispatch.
Box<dyn> or trait objects - maximized compiler optimizationsSend/Sync constraints)use http::Method;
use sark::{
app::App,
server::Server,
service::Service,
http::{Request, Response},
error::Result,
};
struct HelloService;
impl Service for HelloService {
async fn call(&self, _req: Request, _state: &()) -> Result<Response> {
let mut resp = Response::ok();
resp.set_body_str("Hello, World!");
Ok(resp)
}
}
fn main() -> Result<()> {
let app = App::default()
.route(Method::GET, "/", HelloService);
let mut runtime = monoio::RuntimeBuilder::<monoio::LegacyDriver>::new()
.build()
.unwrap();
runtime.block_on(async {
Server::bind("127.0.0.1:3000")
.serve(&app)
.await
})
}
SARK is currently in early development and is not yet recommended for production use.
MIT