pub async fn serve_with_shutdown<C>(
addr: SocketAddr,
state: AppState<C>,
shutdown: impl Future<Output = ()> + Send + 'static,
) -> Result<(), Error>Expand description
Bind addr and serve until shutdown resolves or the listener fails.
Stops accepting once shutdown fires, then waits for outstanding requests
to drain. Note that long-lived kernel WebSocket tunnels never “finish”:
the caller that needs a bounded exit should race this future and drop it
(waratah_bin does exactly that).