diff --git a/rumqttc/CHANGELOG.md b/rumqttc/CHANGELOG.md index c8c8716a3..f1707c9bb 100644 --- a/rumqttc/CHANGELOG.md +++ b/rumqttc/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Made `DisconnectProperties` struct public. * Replace `Vec>` with `FixedBitSet` for managing packet ids of released QoS 2 publishes and incoming QoS 2 publishes in `MqttState`. * Accept `native_tls::TlsConnector` as input for `Transport::tls_with_config`. +* Enforce `Sync` for `AsyncReadWrite` ### Deprecated diff --git a/rumqttc/src/framed.rs b/rumqttc/src/framed.rs index beb1d32de..2b5b34d02 100644 --- a/rumqttc/src/framed.rs +++ b/rumqttc/src/framed.rs @@ -92,5 +92,13 @@ impl Network { } } +// NOTE: WsStream currently doesn't support Sync, so we disable Sync enforcement for websocket builds + +#[cfg(not(feature = "websocket"))] +pub trait AsyncReadWrite: AsyncRead + AsyncWrite + Send + Sync + Unpin {} +#[cfg(not(feature = "websocket"))] +impl AsyncReadWrite for T where T: AsyncRead + AsyncWrite + Send + Sync + Unpin {} +#[cfg(feature = "websocket")] pub trait AsyncReadWrite: AsyncRead + AsyncWrite + Send + Unpin {} +#[cfg(feature = "websocket")] impl AsyncReadWrite for T where T: AsyncRead + AsyncWrite + Send + Unpin {}