Make client able to use non-Send executor#3184
Conversation
|
So, doing this is a bit unfun. Those anonymous futures would need to become structs, with manual Then, we can add in to |
|
I changed the anonymous futures to structs and introduced a trait. And it seams to work mostly. Some cleanup is left. |
src/client/conn/http2.rs
Outdated
| B::Data: Send, | ||
| B::Error: Into<Box<dyn StdError + Send + Sync>>, | ||
| E: ExecutorClient<B, T> + Unpin + Clone, | ||
| <B as http_body::Body>::Error: std::error::Error + Send + Sync + 'static, |
There was a problem hiding this comment.
The line just above, B::Error: Into<..> should be enough. Is it not?
There was a problem hiding this comment.
Is it required to add something here at all? Because currently, this makes it stricter in that not only is it Into, but it must also be Error. That means Box<dyn Error> no longer qualifies (since Box<dyn Error>: Error is not true for confusing reasons).
|
I think this is ready for a second review now. I am not 100% sure if I really understand everything I did, so please review carefully. I got some questions:
I hope I haven't forgotten something important here. |
seanmonstar
left a comment
There was a problem hiding this comment.
Very impressive! I think there's just some dangling clean up that I found.
|
Oh, looks like there's merge conflicts. Would you be up to resolving those? Then we can merge. RC4 is nearly here! |
Closes hyperium#3017 BREAKING CHANGE: `client::conn::http2` types now use another generic for an `Executor`. Code that names `Connection` needs to include the additional generic parameter.
Closes hyperium#3017 BREAKING CHANGE: `client::conn::http2` types now use another generic for an `Executor`. Code that names `Connection` needs to include the additional generic parameter. Signed-off-by: Sven Pfennig <[email protected]>
Closes hyperium#3184 Signed-off-by: Sven Pfennig <[email protected]>
Hi,
I tried to solve #3017. But I got stuck.
I copied and modified existing examples to get one which fails to compile because of the missing send bounds.
The issue suggests to create a extension trait
Executor<InternalFutureType<IO, B>>.But what exactly is the
InternalFutureType<IO, B>? I had the idea of aenum InternalFutureType<IO, B>with variants for everyFuturethat gets spawned and implementingFuturefor it. But most the futures that get spawned are Anonymous or have Anonymous Parts.hyper/src/proto/h2/client.rs
Line 158 in 47f614f
hyper/src/proto/h2/client.rs
Line 259 in 47f614f
hyper/src/proto/h2/client.rs
Line 316 in 47f614f
Maybe the solution is obvious and I just don't see it? Or am I on the wrong path?
Any hint would be helpful.