Skip to content

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
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