rust-lang / futures-rs

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

Compile error[E0432]: unresolved import `futures::Task` #2296

Closed AqlaSolutions closed 3 years ago

AqlaSolutions commented 3 years ago

When I add futures-io as a dependency, my project can't be compiled:

error[E0432]: unresolved import `futures::Task`
 --> C:\Users\Vlad\.cargo\registry\src\github.com-1ecc6299db9ec823\futures-io-0.1.0\src\lib.rs:9:5
  |
9 | use futures::Task;
  |     ^^^^^^^^^----
  |     |        |
  |     |        help: a similar name exists in the module: `task`
  |     no `Task` in the root

[dependencies]
scopeguard = "1"
regex = "1"
reqwest = { version = "0.10", features = ["json"] }
lazy_static = "1.4"
sysinfo = "0.15"
base64 = "0.12"
url = "2.1"
serde = "1.0"
lettre = "0.9"
lettre_email = "0.9"
aerosol = "0.3"
chrono = "0.4"
encoding = "0.2"
rand = "0.7"
rand_xoshiro = "0.4.0"
rltk = "0.8.1"
specs = "0.16"
specs-derive = "0.4"
byteorder = "1"
error-chain = "0.12"
clap = "2.33"
winapi = { version="0.3", features=["debugapi"] }
crossbeam = "0.7"
rayon = "1.5.0"
futures="0.3"
futures-mio="0.1"
futures-tls="0.1"
futures-io="0.3"
futures-task="0.3"
futures-executor = "0.3"
futures-macro = "0.3"
futures-sink = "0.3"
futures-channel = "0.3"
taiki-e commented 3 years ago

futures-mio="0.1" futures-tls="0.1"

These two are very old and are no longer maintained (and probably broken). You should probably be able to compile your project if you remove them.

AqlaSolutions commented 3 years ago

I'm trying to follow a tutorial though it's pretty old https://github.com/rust-lang/futures-rs/blob/6a1950e6cd91cb7fd4f27b19d0090f81dc957a05/TUTORIAL.md#hello-world

It need the Loop and also ClientContext from TLS, are there any replacements?

Also how can I learn about futures-rs features nowadays, is there any tutorial or examples available? I saw only one example at the main documentation page but it doesn't cover enough.

taiki-e commented 3 years ago

It need the Loop and also ClientContext from TLS, are there any replacements?

futures-mio was replaced by tokio, futures-tls was replaced by tokio-tls.

Also how can I learn about futures-rs features nowadays, is there any tutorial or examples available? I saw only one example at the main documentation page but it doesn't cover enough.

async book provides tutorial for the current futures-rs and std::future. (For tokio, see tokio's tutorial.)