use futures_core::Stream;
use crate::{DeviceId, DeviceInfo};
pub struct HotplugWatch(pub(crate) crate::platform::HotplugWatch);
impl Stream for HotplugWatch {
type Item = HotplugEvent;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
self.0.poll_next(cx).map(Some)
}
}
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum HotplugEvent {
Connected(DeviceInfo),
Disconnected(DeviceId),
}
#[test]
fn assert_send_sync() {
fn require_send_sync<T: Send + Sync>() {}
require_send_sync::<HotplugWatch>();
}