I have some data in my program (which is a web server using async-std
and tide
) that I want to periodically update from another http server. So I try to async_std::task::spawn
a function to fetch the data and replace my local data.
Currently, I use hreq
to do the actual fetching. But that means that inside my task, there is a hreq::ResponseFuture
to await, and that is not Send
.
So I guess I have two alternative questions:
- Is there a way to get around this, by somehow localizing the
ResponseFuture
to execute in a single thread or someting? a section of the async book seems to say there isn't, and that kind of makes sense. - Is there a http client crate that works with
async-std
where the request and response types isSend
so it can be used in a task?