Expand description

This module helps to manage the life cycle of the process and to shut things down gracefully.

See https://tokio.rs/tokio/topics/shutdown for more information.


  • Represents some activity which cannot be ruthlessly interrupted. Obtain an Activity instance via Activity::get(). While any Activity instances are alive in the program, LifeCycle::wait_for_shutdown cannot complete.
  • The LifeCycle struct represents the life_cycle of this server process. Creating an instance of it will prepare the global state of the process and allow other code to work with Activity and ShutdownSubcription.
  • ShutdownSubcription can be used by code that is idling. Select on your timeout and ShutdownSubcription::shutting_down to wake up when either the timeout expires or the process is about to shut down.