rust-lang / futures-rs

Zero-cost asynchronous programming in Rust
https://rust-lang.github.io/futures-rs/
Apache License 2.0
5.34k stars 616 forks source link

Unable to import the thread pool #2731

Closed ravieze closed 1 year ago

ravieze commented 1 year ago

I am unable to use the Threadpool. Getting compilation error. Any help?

my cargo.toml is as follows

actix-rt = "2.8.0"
actix-web = "4.3.0"
bytes = "1.4.0"
env_logger = "0.10.0"
json = "0.12"
log = "0.4.17"
log4rs = "1.2.0"
aws-config = "0.54.1"
aws-sdk-s3 = "0.24.0"
tokio = { version = "1.26.0", features = ["full"] }
async-trait = "0.1.64"
aws-smithy-http = "0.54.4"
self-meter = "0.6.0"
serde = { version = "1.0.126", features = ["derive"] }
serde_json = "1.0.64"
# cmake = "0.1.49"
rdkafka = { version = "0.29.0", features = ["cmake-build"] }
# kafka = "0.9.0"
uuid = {version = "1.3.0" , features = ["v4" , "fast-rng", "macro-diagnostics" ] }
futures = "0.3.27"

I am trying to use the Threadpool in my rust code src/utils.rs ON adding the statement to my rust code

use futures::executor::ThreadPool;

I get the below error

unresolved import `futures::executor::ThreadPool`
no `ThreadPool` in `executor`rustc[Click for full compiler diagnostic](rust-analyzer-diagnostics-view:/diagnostic%20message%20%5B0%5D?0#file%3A%2F%2F%2FUsers%2Fravichandra.chitrapu%2Fpoc%2Frust_fair_scheduler%2Fsrc%2Faws_utils.rs)
taiki-e commented 1 year ago

it needs thread-pool feature https://docs.rs/futures/latest/futures/executor/struct.ThreadPool.html

This type is only available when the thread-pool feature of this library is activated.

ravieze commented 1 year ago

nice if docs can be updated. Thank you.