use std::net::SocketAddr; use hyper::Body; use plumb::{Pipe, PipeExt}; use http_mux::route; use http_mux::mux; type Request = http::Request
; type Response = http::Response; #[tokio::main] async fn main() { let addr = SocketAddr::from(([127, 0, 0, 1], 3000)); if let Err(e) = http_mux::hyper::serve(build_mux(), &addr).await { eprintln!("server error: {}", e); } } trait Render { fn render(&self) -> Response; } impl Render for String { fn render(&self) -> Response { Response::new(Body::from(self.clone())) } } impl Render for &'static str { fn render(&self) -> Response { Response::new(Body::from(*self)) } } struct Sum { left : u32, right : u32, } impl Render for Sum { fn render(&self) -> Response { Response::new(Body::from(format!( "{} + {} = {}", self.left, self.right, self.left + self.right, ))) } } fn build_mux() -> impl Pipe { // let mut mux = Mux::>::new(); // let mut mux = new_mux::new_mux(); //Mux::>::new(); mux::new_mux::