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

io: add AsyncReadExt::read_buf #3003

Merged
merged 6 commits into from
Oct 21, 2020
Merged

io: add AsyncReadExt::read_buf #3003

merged 6 commits into from
Oct 21, 2020

Conversation

carllerche
Copy link
Member

Brings back read_buf from 0.2. This will be stabilized as part of 1.0.

I need to add tests still.

ready!(Pin::new(me.reader).poll_read(cx, &mut buf)?);

// Ensure the pointer does not change from under us
assert_eq!(ptr, buf.filled().as_ptr());
Copy link
Member Author

Choose a reason for hiding this comment

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

This the right way to ensure safety?

Copy link
Contributor

Choose a reason for hiding this comment

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

We used std::ptr::eq elsewhere, but it should be the same.

Brings back `read_buf` from 0.2. This will be stabilized as part of 1.0.
@Darksonn Darksonn added A-tokio Area: The main tokio crate C-enhancement Category: A PR with an enhancement or bugfix. M-io Module: tokio/io labels Oct 20, 2020
@taiki-e
Copy link
Member

taiki-e commented Oct 20, 2020

This will be stabilized as part of 1.0.

If this means that bytes v1 will be released before tokio v1, I have no objection to adding these APIs.
However, if we find that bytes v1 can't actually be released before tokio v1, I'd prefer tokio v1 to remove these APIs or, as mentioned in #2870 (comment), provide these APIs under a feature flag that includes the version number.

@carllerche
Copy link
Member Author

@taiki-e we are aiming to release bytes 1.0 w/ tokio 1.0. I would suggest watching the changes on that repo to track the direction.

@carllerche carllerche marked this pull request as ready for review October 21, 2020 05:08
tokio/src/io/util/async_write_ext.rs Outdated Show resolved Hide resolved
tokio/src/io/util/async_write_ext.rs Show resolved Hide resolved
Co-authored-by: Alice Ryhl <alice@ryhl.io>
@carllerche carllerche merged commit 8dbc3c7 into master Oct 21, 2020
@carllerche carllerche deleted the bring-back-read-buf branch October 21, 2020 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-enhancement Category: A PR with an enhancement or bugfix. M-io Module: tokio/io
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants