pub async fn disconnect_async(&mut self) -> Result<(), WifiError> {
        // If not connected, this will do nothing.
        // It will also wait forever for a `StaDisconnected` event that will never come.
        // Return early instead of hanging.
        if !matches!(self.is_connected(), Ok(true)) {
            return Ok(());
        }

        Self::clear_events(WifiEvent::StaDisconnected);
        crate::wifi::WifiController::disconnect_impl(self)?;
        WifiEventFuture::new(WifiEvent::StaDisconnected).await;

        Ok(())
    }
Async version of [`crate::wifi::WifiController`]'s `Disconnect`
method
esp-wifi/src/wifi/mod.rs