open-net 0.3.5

A cross-platform async networking library for Rust with HTTP and WebSocket clients, network status monitoring, configurable retries, WebSocket reconnection and heartbeats, and managed client lifecycles. Reuse common networking infrastructure across applications to avoid repeated implementation and debugging, helping save development time and AI coding tokens.
Documentation
use crate::module::http::http_client_inner::{CancellationSignal, HttpClientInner};
use std::sync::Arc;

pub(crate) struct RequestWaitGuard {
    // Retain the client until the waiting future has settled.
    _inner: Arc<HttpClientInner>,
    control: Arc<CancellationSignal>,
    armed: bool,
}
impl RequestWaitGuard {
    pub(crate) fn new(inner: Arc<HttpClientInner>, control: Arc<CancellationSignal>) -> Self {
        Self {
            _inner: inner,
            control,
            armed: true,
        }
    }
    pub(crate) fn disarm(mut self) {
        self.armed = false;
    }
}
impl Drop for RequestWaitGuard {
    fn drop(&mut self) {
        if self.armed {
            self.control.cancel();
        }
    }
}