MCPcopy Index your code
hub / github.com/Rust-Web-Development/code / oneshot

Function oneshot

ch_11/src/lib.rs:127–143  ·  view source on GitHub ↗
(store: store::Store)

Source from the content-addressed store, hash-verified

125}
126
127pub async fn oneshot(store: store::Store) -> OneshotHandler {
128 let routes = build_routes(store).await;
129 let (tx, rx) = oneshot::channel::<i32>();
130
131 let socket: std::net::SocketAddr = "127.0.0.1:3030"
132 .to_string()
133 .parse()
134 .expect("Not a valid address");
135
136 let (_, server) = warp::serve(routes).bind_with_graceful_shutdown(socket, async {
137 rx.await.ok();
138 });
139
140 tokio::task::spawn(server);
141
142 OneshotHandler { sender: tx }
143}

Callers 1

mainFunction · 0.85

Calls 1

build_routesFunction · 0.85

Tested by

no test coverage detected