-
Notifications
You must be signed in to change notification settings - Fork 339
Re-export IO traits from futures #224
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yoshuawuyts
approved these changes
Sep 22, 2019
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.
As discussed, this should remove some surprising edges from async-std. This patch looks great; when CI passes I'm 👍 with merging this!
bors r+ |
bors bot
added a commit
that referenced
this pull request
Sep 22, 2019
224: Re-export IO traits from futures r=stjepang a=stjepang Sorry for the big PR! Instead of providing our own traits `async_std::io::{Read, Write, Seek, BufRead}`, we now re-export `futures::io::{AsyncRead, AsyncWrite, AsyncSeek, AsyncRead}`. While re-exporting we rename them to strip away the "Async" prefix. The documentation will display the contents of the original traits from the `futures` crate together with our own extension methods. There's a note in the docs saying the extenion methods become available only when `async_std::prelude::*` is imported. Our extension traits are re-exported into the prelude, but are marked with `#[doc(hidden)]` so they're completely invisible to users. The benefit of this is that people can now implement traits from `async_std::io` for their types and stay compatible with `futures`. This will also simplify some trait bounds in our APIs - for example, things like `where Self: futures_io::AsyncRead`. At the same time, I cleaned up some trait bounds in our stream interfaces, but haven't otherwise fiddled with them much. I intend to follow up with another PR doing the same change for `Stream` so that we re-export the stream trait from `futures`. Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
Build failed
|
bors bot
added a commit
that referenced
this pull request
Sep 22, 2019
224: Re-export IO traits from futures r=stjepang a=stjepang Sorry for the big PR! Instead of providing our own traits `async_std::io::{Read, Write, Seek, BufRead}`, we now re-export `futures::io::{AsyncRead, AsyncWrite, AsyncSeek, AsyncRead}`. While re-exporting we rename them to strip away the "Async" prefix. The documentation will display the contents of the original traits from the `futures` crate together with our own extension methods. There's a note in the docs saying the extenion methods become available only when `async_std::prelude::*` is imported. Our extension traits are re-exported into the prelude, but are marked with `#[doc(hidden)]` so they're completely invisible to users. The benefit of this is that people can now implement traits from `async_std::io` for their types and stay compatible with `futures`. This will also simplify some trait bounds in our APIs - for example, things like `where Self: futures_io::AsyncRead`. At the same time, I cleaned up some trait bounds in our stream interfaces, but haven't otherwise fiddled with them much. I intend to follow up with another PR doing the same change for `Stream` so that we re-export the stream trait from `futures`. Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
Canceled |
bors r+ |
bors bot
added a commit
that referenced
this pull request
Sep 22, 2019
224: Re-export IO traits from futures r=stjepang a=stjepang Sorry for the big PR! Instead of providing our own traits `async_std::io::{Read, Write, Seek, BufRead}`, we now re-export `futures::io::{AsyncRead, AsyncWrite, AsyncSeek, AsyncRead}`. While re-exporting we rename them to strip away the "Async" prefix. The documentation will display the contents of the original traits from the `futures` crate together with our own extension methods. There's a note in the docs saying the extenion methods become available only when `async_std::prelude::*` is imported. Our extension traits are re-exported into the prelude, but are marked with `#[doc(hidden)]` so they're completely invisible to users. The benefit of this is that people can now implement traits from `async_std::io` for their types and stay compatible with `futures`. This will also simplify some trait bounds in our APIs - for example, things like `where Self: futures_io::AsyncRead`. At the same time, I cleaned up some trait bounds in our stream interfaces, but haven't otherwise fiddled with them much. I intend to follow up with another PR doing the same change for `Stream` so that we re-export the stream trait from `futures`. Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
Build succeeded
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sorry for the big PR!
Instead of providing our own traits
async_std::io::{Read, Write, Seek, BufRead}
, we now re-exportfutures::io::{AsyncRead, AsyncWrite, AsyncSeek, AsyncRead}
. While re-exporting we rename them to strip away the "Async" prefix.The documentation will display the contents of the original traits from the
futures
crate together with our own extension methods. There's a note in the docs saying the extenion methods become available only whenasync_std::prelude::*
is imported.Our extension traits are re-exported into the prelude, but are marked with
#[doc(hidden)]
so they're completely invisible to users.The benefit of this is that people can now implement traits from
async_std::io
for their types and stay compatible withfutures
. This will also simplify some trait bounds in our APIs - for example, things likewhere Self: futures_io::AsyncRead
.At the same time, I cleaned up some trait bounds in our stream interfaces, but haven't otherwise fiddled with them much.
I intend to follow up with another PR doing the same change for
Stream
so that we re-export the stream trait fromfutures
.