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

Make access inner of futures::io::{BufReader,BufWriter} not require inner trait bound #2848

Merged
merged 1 commit into from
Mar 31, 2024

Conversation

ethe
Copy link
Contributor

@ethe ethe commented Mar 31, 2024

Currently, accessing the inner of futures::io::{BufReader, BufWriter} requires that the inner type implements AsyncRead or AsyncWrite. This constraint is much stricter than the semantics of inner access require. Removing the trait bound would be helpful in cases where pass-through functions simply obtain a reference to the inner I/O object for further use, without having to specify the inner trait bound explicitly.

@taiki-e
Copy link
Member

taiki-e commented Mar 31, 2024

Thanks for the PR. I'm in favor of accepting this as std::io::BufReader does the same thing.
https://doc.rust-lang.org/nightly/std/io/struct.BufReader.html

That said, I think it would be good to remove the bound from not only these accessors, but also from non constructor methods such as buffer, as std::io::BufReader does.

@taiki-e taiki-e added the A-io Area: futures::io label Mar 31, 2024
@ethe
Copy link
Contributor Author

ethe commented Mar 31, 2024

I totally agree, I do the same thing on other non custructor methods just now.

…BufReader,BufWriter} not require

inner trait bound
Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Thanks!

@taiki-e taiki-e merged commit bb63c37 into rust-lang:master Mar 31, 2024
24 checks passed
taiki-e pushed a commit that referenced this pull request Oct 5, 2024
@taiki-e taiki-e mentioned this pull request Oct 5, 2024
taiki-e pushed a commit that referenced this pull request Oct 5, 2024
taiki-e pushed a commit that referenced this pull request Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants