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

Variant of Stream::collect() that returns the stream #1260

Open
srwalter opened this issue Sep 13, 2018 · 1 comment
Open

Variant of Stream::collect() that returns the stream #1260

srwalter opened this issue Sep 13, 2018 · 1 comment
Labels
A-stream Area: futures::stream C-feature-request

Comments

@srwalter
Copy link

Suppose I use collect() in conjunction with take_while():

my_stream.take_while(foo).collect()

In the absence of collect(), I would be able to use TakeWhile::into_inner() to recover the original stream and process the remainder of its data. However, collect() takes ownership of the stream, and there is no way to recover it.

I could envision either implementing Collect::into_inner() or making a variant of collect() whose Item is (Vec<...>, S)

@Xanewok
Copy link
Member

Xanewok commented Jan 1, 2019

If I'm not mistaken, you can use Stream::by_ref to keep ownership of the underlying stream.

@taiki-e taiki-e added the A-stream Area: futures::stream label Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stream Area: futures::stream C-feature-request
Projects
None yet
Development

No branches or pull requests

4 participants