Struct GracefulShutdown
pub struct GracefulShutdown { /* private fields */ }
A graceful shutdown utility
Implementations
impl GracefulShutdown
fn new() -> SelfCreate a new graceful shutdown helper.
fn watch<C: GracefulConnection>(&self, conn: C) -> impl Future<Output = C::Output> + use<C>Wrap a future for graceful shutdown watching.
fn watcher(&self) -> WatcherCreate an owned type that can watch a connection.
This method allows created an owned type that can be sent onto another task before calling [
Watcher::watch()].async fn shutdown(self)Signal shutdown for all watched connections.
This returns a
Futurewhich will complete once all watched connections have shutdown.fn count(&self) -> usizeReturns the number of the watching connections.
Trait Implementations
impl Debug for GracefulShutdown
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for GracefulShutdown
fn default() -> Self
Auto Trait Implementations
impl !RefUnwindSafe for GracefulShutdown
impl !UnwindSafe for GracefulShutdown
impl Freeze for GracefulShutdown
impl Send for GracefulShutdown
impl Sync for GracefulShutdown
impl Unpin for GracefulShutdown
impl UnsafeUnpin for GracefulShutdown
Blanket Implementations
impl<T> Any for GracefulShutdown
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for GracefulShutdown
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for GracefulShutdown
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for GracefulShutdown
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for GracefulShutdown
impl<T> WithSubscriber for GracefulShutdown
impl<T, U> Into<U> for GracefulShutdown
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for GracefulShutdown
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for GracefulShutdown
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>