4 ms·
Can you elaborate on why the `mixing` approach doesn't work? Specifically, if you want send bounds, doing this: trait HttpService: Send { fn fetch(
by kurtbuilds 3y ago
Can you elaborate on why the `mixing` approach doesn't work? Specifically, if you want send bounds, doing this:
trait HttpService: Send {
fn fetch(&self, url: Url)
-> impl Future<Output = HtmlBody> + Send;
}
impl HttpService for MyService {
async fn fetch(&self, url: Url) -> HtmlBody {
// This works, as long as `do_fetch(): Send`!
self.client.do_fetch(url).await.into_body()
}
}
- gdcbe 3y agoOf course that works. But only as long as everything is always hardcoded as Send. Which is a known limitation, so no complaints. Edit: also the problem is about the method async returned future trait bounds, not the Self.