Skip to main content

ShutdownToken

Type Alias ShutdownToken 

Source
pub type ShutdownToken = CancellationToken;
Expand description

A token that can be used to gracefully shut down a Client.

Obtained from Client::connect — call ShutdownToken::cancel to begin graceful shutdown. All pending requests will finish and the reader task will exit cleanly.

§Example

use layer_client::{Client, Config, ShutdownToken};

let (client, shutdown) = Client::connect(Config::default()).await?;

// In a signal handler or background task:
// shutdown.cancel();

Aliased Type§

pub struct ShutdownToken { /* private fields */ }