hyperium / hyperium/hyper

Error: use of undeclared type or module `futures_util`

Open
#2,249 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.3k
Forks
1.8k
Avg merge
1d 22h
Merged PRs (30d)
14

Description

Hi, I straight up copied the echo example and am trying to run it.

I tried putting this in my Cargo.toml [dependencies]

[dependencies]
hyper = "0.13"
tokio = { version = "0.2", features = ["full"] }
futures-core = { version = "0.3", default-features = false }
futures-channel = "0.3"
futures-util = { version = "0.3", default-features = false }

[dev-dependencies]
futures-util = { version = "0.3", default-features = false, features = ["alloc"] }

But when in my IDE and when I try to run it I see these two errors:

error[E0433]: failed to resolve: use of undeclared type or module `futures_util`
 --> src/main.rs:3:5
  |
3 | use futures_util::stream::try_stream::TryStreamExt;
  |     ^^^^^^^^^^^^ use of undeclared type or module `futures_util`
error[E0599]: no method named `map_ok` found for struct `hyper::body::body::Body` in the current scope
  --> src/main.rs:21:48
   |
21 |             let chunk_stream = req.into_body().map_ok(|chunk| {
   |                                                ^^^^^^ method not found in `hyper::body::body::Body`
   |
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
3  | use futures_util::stream::try_stream::TryStreamExt;
   |

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/echo.rs and the user's src/main.rs, then compare the Cargo.toml dependency declarations with the example's imports. Reproduce the reported compiler errors and determine whether the example or its dependency instructions need updating; done means the example's documented setup compiles without these errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.