//! Plain benchmark server: the `load_profile` request path with zero causal //! machinery — the baseline half of the ka/close A/B matrix (the //! throughput-inversion chase). //! //! Identical route, handler, and `Config` construction to `load_profile`; //! differs only in having no `smarm-causal` feature, no sweep, and no //! shutdown path — it serves until killed. Throughput is measured //! externally (wrk). //! //! Env: //! URUS_PORT listen port (default 8080; binds 0.0.0.0) //! //! cargo run --release --example plain_serve use std::net::SocketAddr; use urus::{serve_with, Config, Conn, Next, Pipeline, Router}; /// Mirrors `load_profile`'s handler byte for byte: param parse + JSON render. fn json_id(conn: Conn, _next: Next) -> Conn { let id: u64 = conn.params.get("id").and_then(|s| s.parse().ok()).unwrap_or(0); conn.put_status(200) .put_header("content-type", "application/json") .put_body(format!("{{\"id\":{id}}}")) } fn main() { let port: u16 = std::env::var("URUS_PORT") .ok() .and_then(|v| v.parse().ok()) .unwrap_or(8080); let addr: SocketAddr = format!("0.0.0.0:{port}").parse().expect("addr"); let pipe = Pipeline::new().plug(Router::new().get("/json/:id", json_id)); serve_with(Config::new(addr), pipe).expect("serve"); }