Repository: bytebeamio/rumqtt (language: rust)

Issue:
rumqttc: why two executors?
Why does rumqttc contain both tokio and futures executors?


Discussion / hints:
i am not sure what you mean by two executors. [futures](https://docs.rs/futures/0.3.28/futures/) is not a async runtime like tokio.
feel free to re-open if its not clear, or i didn't understand the question.
So they are used for different purposes?
yes `futures` crate only provides abstraction and extensions for working with futures.
As well as an executor gated by the enabled-by-default `executor` feature.
Oh, good catch. I thought that executor was just used by them for internal testing, didn't know its enabled by default.

From a quick search looks like we are only using it for [`FutureExt`](https://docs.rs/futures-util/0.3.28/futures_util/future/trait.FutureExt.html). so instead of using `futures` we can import it directly from `futures_util` crate.
Ah, alright. I can handle this PR. Remind me in a few days if I forget :)

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 5d4dfdf51..e69c5e3f7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1969,7 +1969,7 @@ dependencies = [
  "bytes",
  "color-backtrace",
  "flume",
- "futures 0.3.25",
+ "futures-util",
  "http",
  "log",
  "matches",
diff --git a/rumqttc/Cargo.toml b/rumqttc/Cargo.toml
index b08565530..18e0033c0 100644
--- a/rumqttc/Cargo.toml
+++ b/rumqttc/Cargo.toml
@@ -21,7 +21,7 @@ websocket = ["dep:async-tungstenite", "dep:ws_stream_tungstenite", "dep:http"]
 proxy = ["dep:async-http-proxy"]
 
 [dependencies]
-futures = "0.3"
+futures-util = { version = "0.3", default_features = false, features = ["std"] }
 tokio = { version = "1.0", features = ["rt", "macros", "io-util", "net", "time"] }
 bytes = "1.0"
 log = "0.4"
diff --git a/rumqttc/src/client.rs b/rumqttc/src/client.rs
index a007b56a7..e8a6ddda6 100644
--- a/rumqttc/src/client.rs
+++ b/rumqttc/src/client.rs
@@ -7,7 +7,7 @@ use crate::{valid_topic, ConnectionError, Event, EventLoop, MqttOptions, Request
 
 use bytes::Bytes;
 use flume::{SendError, Sender, TrySendError};
-use futures::FutureExt;
+use futures_util::FutureExt;
 use tokio::runtime::{self, Runtime};
 use tokio::time::timeout;
 
diff --git a/rumqttc/src/v5/client.rs b/rumqttc/src/v5/client.rs
index 61ac17adf..30006e5ca 100644
--- a/rumqttc/src/v5/client.rs
+++ b/rumqttc/src/v5/client.rs
@@ -12,7 +12,7 @@ use crate::valid_topic;
 
 use bytes::Bytes;
 use flume::{SendError, Sender, TrySendError};
-use futures::FutureExt;
+use futures_util::FutureExt;
 use tokio::runtime::{self, Runtime};
 use tokio::time::timeout;
 


Test patch: