1个稳定版本
1.0.0 | 2024年6月13日 |
---|
#6 in #ctrl-c
3KB
terminal-wait-exit
等待用户退出终端,如Ctrl+C。
用法
#[tokio::main]
async fn main() {
// Spawn the server into a runtime
tokio::spawn(async move {
// work
server.serve(service).await;
});
if let Err(e) = wait_exit::wait_exit().await {
error!("Listening exit failed.{:?}", e);
}
stop_graceful();
}
依赖
~3–11MB
~107K SLoC