The Wayback Machine - https://web.archive.org/web/20200910202823/https://github.com/rust-lang/futures-rs/pull/1997
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

Add `IntoAsyncRead::into_inner()` method and test #1997

Open
wants to merge 2 commits into
base: master
from

Conversation

@acfoltzer
Copy link

acfoltzer commented Dec 6, 2019

This is useful when you don't necessarily want to consume the entire stream as a reader, but still want to retain the stream for other uses.

The nested tuple/Option/tuple is a bit awkward, but minimal. Do you think it'd be worth making a single-purpose enum to return here instead? For readability of code that calls this method, I added an enum.

This is useful when you don't necessarily want to consume the entire stream as a reader, but still
want to retain the stream for other uses.
@acfoltzer
Copy link
Author

acfoltzer commented Dec 6, 2019

This build failure is pretty puzzling to me, as I cannot duplicate it even with the exact same nightly compiler on Ubuntu 18.04: https://travis-ci.com/rust-lang/futures-rs/jobs/264248283

This makes code that calls this method look far less mysterious, even if it is more verbose.
@acfoltzer acfoltzer force-pushed the acfoltzer:acf/into-async-read-into-inner branch from 8600adf to 100594a Dec 7, 2019
@cramertj
Copy link
Member

cramertj commented Dec 10, 2019

Hey, sorry for the delay! I don't quite have the time to properly review this right now, but I'll be sure to take a look in the next few days.

@taiki-e
Copy link
Member

taiki-e commented Aug 29, 2020

All existing into_inner methods discard the combinator state and return only the underlying stream. Any reason why this returns an own enum containing the state instead of returning the Option<St>? (Methods that return combinator state can cause problems when the internal implementation changes.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.