-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
where | ||
E: Executor<BoxSendFuture> + Send + Sync + 'static, | ||
T: AsyncRead + AsyncWrite + Unpin + Send + 'static, | ||
B: Body + 'static, | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line just above, B::Error: Into<..>
should be enough. Is it not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very impressive! I think there's just some dangling clean up that I found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very well done!
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 everyFuture
that gets spawned and implementingFuture
for 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.