Skip to content

add io::prelude #160

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 2 commits into from
Sep 8, 2019
Merged

add io::prelude #160

merged 2 commits into from
Sep 8, 2019

Conversation

yoshuawuyts
Copy link
Contributor

@yoshuawuyts yoshuawuyts commented Sep 8, 2019

I was working on some async io code earlier, and ended up writing:

    use async_std::io::{BufReader, BufRead, Read};

It took a bit of trial and error to get the right traits in scope, and I kind of wished I had io::prelude available so it would just work. Which is why this patch adds io::prelude. I guess I'm kind of circling back on the idea of only having a single prelude; but overall I think this feels more intuitive. Thanks!

Screenshots

Screenshot_2019-09-08 async_std io - Rust
Screenshot_2019-09-08 async_std io prelude - Rust
Screenshot_2019-09-08 std io prelude - Rust

Signed-off-by: Yoshua Wuyts <[email protected]>
Signed-off-by: Yoshua Wuyts <[email protected]>
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Thanks!

@ghost
Copy link

ghost commented Sep 8, 2019

bors r+

bors bot added a commit that referenced this pull request Sep 8, 2019
160: add io::prelude r=stjepang a=yoshuawuyts

I was working on some async io code earlier, and ended up writing:
```rust
    use async_std::io::{BufReader, BufRead, Read};
```

It took a bit of trial and error to get the right traits in scope, and I kind of wished I had `io::prelude` available so it would *just work*. Which is why this patch adds `io::prelude`. I guess I'm kind of circling back on the idea of only having a single prelude; but overall I think this feels more intuitive. Thanks!

## Screenshots
![Screenshot_2019-09-08 async_std io - Rust](https://user-images.githubusercontent.com/2467194/64481454-8e2f8500-d1dc-11e9-9299-7a82b7dbb031.png)
![Screenshot_2019-09-08 async_std io prelude - Rust](https://user-images.githubusercontent.com/2467194/64481455-8e2f8500-d1dc-11e9-9d20-1e90fabccaf4.png)
![Screenshot_2019-09-08 std io prelude - Rust](https://user-images.githubusercontent.com/2467194/64481509-bfa85080-d1dc-11e9-9965-be7d0d84b551.png)



Co-authored-by: Yoshua Wuyts <[email protected]>
@bors
Copy link
Contributor

bors bot commented Sep 8, 2019

Build succeeded

  • continuous-integration/travis-ci/push

@bors bors bot merged commit ec1f33f into master Sep 8, 2019
@yoshuawuyts yoshuawuyts deleted the io-prelude branch September 8, 2019 09:48
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.

1 participant