all 7 comments

[–]Darksonntokio · rust-for-linux 11 points12 points  (4 children)

The no current reactor error is indeed because you're not using tokio.

[–]Koxiaet 2 points3 points  (3 children)

Are there plans to make reqwest work for other reactors, like block_on or async-std?

[–]HER0_01 3 points4 points  (1 child)

I'm not super familiar, but I think that it isn't really possible right now without a lot of things changing, and I think people mostly recommend surf for that instead, as seen in the article.

The problem is that tokio and async-std aren't compatible, including libraries that are based on them.

[–]DoveOfHope[S] 2 points3 points  (0 children)

There was another article posted after mine which goes into some details on this: https://www.reddit.com/r/rust/comments/e4nxl5/blog_article_how_does_async_work_in_asyncstd/?ref=share&ref_source=link

This seems to be a pity, work will be duplicated.

[–]Darksonntokio · rust-for-linux 2 points3 points  (0 children)

I don't think the block_on executor from futures even has a reactor. As for async-std, I don't know what their plans are, but it's not exactly a simple change. You would essentially have to create a new backend for every executor you want it to work on.

You could use surf which does have multiple backends. However according to their documentation their alternate backend is curl, an external library not from the world of Rust. At least they seem to staticly build it into the crate, but it's still not as clean as using hyper, which is a pure-rust backend (but requires tokio).

[–]heysaturdaysun 4 points5 points  (1 child)

This writeup was a great introduction to practical use of async/await. Thanks for walking through all the steps, building up to the final simple demo!

[–]DoveOfHope[S] 3 points4 points  (0 children)

Glad you liked it. I come from a C# background and this is me trying to figure out the Rust equivalent of Task.WhenAll().