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

Lack of documentation on Read trait #3649

Open
Mubelotix opened this issue Apr 25, 2024 · 2 comments
Open

Lack of documentation on Read trait #3649

Mubelotix opened this issue Apr 25, 2024 · 2 comments
Labels
A-docs Area: documentation. A-rt Area: runtime traits/utils E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@Mubelotix
Copy link

Mubelotix commented Apr 25, 2024

I have come to the need of implementing hyper::rt::Read on a custom struct. It seems to me that its documentation has been copy-pasted from tokio's AsyncRead, except it's outdated since the signature has been changed. For some reason not stated in the doc, a ReadBufCursor is used instead of the original ReadBuf. Now, I simply couldn't understand from the doc how I was supposed to implement Read, considering ReadBufCursor only has 2 unsafe methods and isn't too-well documented either. I would greatly appreciate further official guidance on implementing the Read trait. Thank you for making hyper

@Mubelotix Mubelotix added the C-feature Category: feature. This is adding a new feature. label Apr 25, 2024
@seanmonstar seanmonstar added E-easy Effort: easy. A task that would be a great starting point for a new contributor. A-docs Area: documentation. A-rt Area: runtime traits/utils and removed C-feature Category: feature. This is adding a new feature. labels Apr 26, 2024
@seanmonstar
Copy link
Member

Agreed, it is lacking in documentation. That'd be helpful to improve.

Regarding the ReadBufCursor, that comes from lessons learned in Tokio: only passing a &mut Thing allows the receiver to do something like *buf = Box::leak(blah), and then the underlying buffer pointer is different. You can see a similar "improvement" in the unstable std::io::BorrowedBuf and BorrowedCursor.

It only has the minimum methods in hyper because I wanted "needs" to drive adding methods, instead of trying to guess which might be useful.

@npetrangelo
Copy link

What is the status of this issue? It looks like there's a doc comment on it now
https://github.com/hyperium/hyper/blob/master/src/rt/io.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation. A-rt Area: runtime traits/utils E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

No branches or pull requests

3 participants