0

When I was using the hyper server, I wanted to be able to shut it down gracefully. So I was using with_graceful_shutdown() to get a Future.

The following code works fine.

    let signer = Arc::new(Notify::new());
    let waiter = signer.clone();
    let graceful = server.with_graceful_shutdown(waiter.notified());
    tokio::spawn(async move {
        time.sleep(ONE_SEC).await;
        signer.notify_one();
    });
    graceful.await
...

But now I want to save the `graceful` variable above into a structure so that I can easily call .await at the right time to start the server, instead of starting it directly in this function.

However, I so want to have a hard time writing the exact type of `graceful`. Can someone help me?

progquester
  • 1,228
  • 14
  • 23

0 Answers0