Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: on AsyncReadWrite enforce Sync #901

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rumqttc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Made `DisconnectProperties` struct public.
* Replace `Vec<Option<u16>>` 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

Expand Down
8 changes: 8 additions & 0 deletions rumqttc/src/framed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> AsyncReadWrite for T where T: AsyncRead + AsyncWrite + Send + Sync + Unpin {}
#[cfg(feature = "websocket")]
pub trait AsyncReadWrite: AsyncRead + AsyncWrite + Send + Unpin {}
#[cfg(feature = "websocket")]
impl<T> AsyncReadWrite for T where T: AsyncRead + AsyncWrite + Send + Unpin {}