-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is this compatible with async-std? #719
Comments
I saw this on tokio site
So will reqwest possible use async-std block_on method? |
No, as part of reqwest's goal of providing a powerful batteries-included HTTP client, it makes various decisions on dependencies. We choose to make use of the Tokio runtime. The reason it won't work is because Tokio chooses a strategy that requires its event loop, IO driver, and timer to be available in the same thread as the executing future, instead of making those things be extra background threads with synchronization. That is why when for instance the However, it's pretty simple to use reqwest with Tokio (reqwest 0.10.0-alpha.2 requires tokio 0.2.0-alpha.6, we're moving as quickly as possible to update to the final tokio 0.2.0 release): #[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let mut url = "https://www.google.com";
let res = reqwest::get(url)
.await?
.text()
.await?;
println!("{}", &res);
println!("hello");
Ok(())
} |
Tokio 2.0 already came out :), thank you for answering me |
There's some support for WASM, why not async-std too? |
I was trying to use async_std::task::block_on with reqwest 0.10.0-alpha.2, and I got an error
reqwest::Error { kind: Request, url: "xxxx", source: Error(Connect, Custom { kind: Other, error: "no current reactor" }) }
here's my code
How could I make this work?
The text was updated successfully, but these errors were encountered: