lemunozm / message-io

Fast and easy-to-use event-driven network library.
Apache License 2.0
1.12k stars 75 forks source link

Build error with Tungstenite 0.22.0+ #173

Closed TechnoPorg closed 5 months ago

TechnoPorg commented 5 months ago

Since https://github.com/snapview/tungstenite-rs/commit/c21281abbc65d50fa00a820014dd0bab0ac0b9e3, support for url::Url in the tungstenite library has become an optional feature that is disabled by default. Since message-io currently relies on tungstenite's default trait implementations for url::Url, this change causes a build error with tungstenite >= v0.22.0:

error[E0277]: the trait bound `url::Url: IntoClientRequest` is not satisfied
   --> /home/USER/.cargo/registry/src/index.crates.io-6f17d22bba15001f/message-io-0.18.1/src/adapters/ws.rs:199:38
    |
199 |                     match ws_connect(url, stream) {
    |                           ---------- ^^^ the trait `IntoClientRequest` is not implemented for `url::Url`
    |                           |
    |                           required by a bound introduced by this call
    |
    = help: the following other types implement trait `IntoClientRequest`:
              httparse::Request<'h, 'b>
              ClientRequestBuilder
              tungstenite::http::Request<()>
              Uri
              std::string::String
              &'a str
              &'a std::string::String
              &'a Uri
note: required by a bound in `client`
   --> /home/USER/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.23.0/src/client.rs:176:10

The problem can be solved either by limiting tungstenite to versions < 0.22.0, or by requiring a version >= 0.22.0 and explicitly enabling the url feature.

lemunozm commented 4 months ago

Released in v0.18.2