Skip to content
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

Implement "split_mut" for TcpStream #1289

Merged
merged 2 commits into from
Jul 16, 2019
Merged

Conversation

Diggsey
Copy link
Contributor

@Diggsey Diggsey commented Jul 11, 2019

Motivation

See here for a longer motivation:
rust-lang/futures-rs#1727

The TLDR is that I think a "split_mut" method on types implementing traits like AsyncRead could open up the possibility of the AsyncRead/AsyncWrite trait methods returning "normal-ish" futures, and eventually allow the methods on these traits to be implemented using async functions

Note: this is more useful than it might appear, because the Pin API allows the ownership of a TcpStream, and non-static borrows of that TcpStream to be bundled into a future without any lifetime bounds of its own.

@carllerche carllerche mentioned this pull request Jul 15, 2019
8 tasks
Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍 looks good to me. I like this strategy.

I have some bikeshed level thoughts, but I just tracked them in #1209.

I do think that split_mut should become the "primary" split fn. I don't have a great name for the existing split (maybe into_split?). Thoughts?

@carllerche
Copy link
Member

It just needs to have a rustfmt pass.

@Diggsey
Copy link
Contributor Author

Diggsey commented Jul 15, 2019

Great 👍

@carllerche carllerche merged commit 0d99ddd into tokio-rs:master Jul 16, 2019
@Diggsey Diggsey deleted the split_mut branch July 16, 2019 23:11
@carllerche carllerche mentioned this pull request Aug 9, 2019
6 tasks
@blckngm blckngm mentioned this pull request Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants