The async example is useful, but being new to Rust and Tokio, I am struggling to work out how to do N requests at once, using URLs from a vector, and creating an iterator of the response HTML for each URL as a string.
How could this be done?
The async example is useful, but being new to Rust and Tokio, I am struggling to work out how to do N requests at once, using URLs from a vector, and creating an iterator of the response HTML for each URL as a string.
How could this be done?
As of reqwest 0.9:
stream::iter_ok
Take a collection of strings and convert it into a
Stream
.Stream::concat2
,Stream::from_err
Take each response's body stream and collect it all into one big chunk.
Stream::buffer_unordered
Convert a stream of futures into a stream of those future's values, executing the futures in parallel.
Stream::for_each
Convert the stream back into a future.
See also: