I'm trying to run a Yew app using Trunk that uses reqwest to get contents of a GitHub repo. For that, I need some extra reqwest features, but Trunk throws out this error:
error[E0433]: failed to resolve: could not find `blocking` in `reqwest`
--> src\github_dir_listing.rs:19:29
|
19 | let response = reqwest::blocking::get(contents_url)
| ^^^^^^^^ could not find `blocking` in `reqwest`
My Cargo.toml
:
[dependencies]
reqwest = { version = "0.11.0", features = ["blocking", "json"] }
yew = { version = "0.20.0", features = ["csr"] }
[features]
default = ["reqwest/blocking", "reqwest/json"]
Trunk command that I tried: trunk serve --features default
.
I also tried defining a "blocking" and "json" feature in the Cargo.toml
:
[features]
blocking = ["reqwest/blocking"]
json = ["reqwest/json"]
And then running trunk serve --features blocking,json
, but to no avail.
I'm new to Rust, but I'm confused, since cargo build
doesn't throw any errors.
PS: I'm using the "blocking" feature since Yew components cannot be async.