Skip to main content

with_timeout

Function with_timeout 

Source
pub async fn with_timeout<F: Future>(
    timeout: Duration,
    connect: F,
) -> Result<F::Output, WsError>
Expand description

Run a caller’s own connect future, giving up after timeout with Kind::ConnectTimeout.

The future’s own output comes back as it is, so its errors stay the caller’s. Install the rustls provider before a TLS connect of its own (ensure_crypto_provider).