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 dedupe() to StreamExt #51

Open
jquesada2016 opened this issue Jan 8, 2022 · 2 comments
Open

Add dedupe() to StreamExt #51

jquesada2016 opened this issue Jan 8, 2022 · 2 comments

Comments

@jquesada2016
Copy link

I am surprised this is something not currently implemented for Stream, unless I am missing something. It would be a great addition.

@taiki-e
Copy link
Collaborator

taiki-e commented Jan 9, 2022

It is not surprising that methods that do not exist in Iterator are not implemented in StreamExt.
https://doc.rust-lang.org/nightly/std/index.html?search=dedupe

Also, please describe the specific behavior you need. dedupe has at least two patterns (contiguous elements vs all elements).

@jquesada2016
Copy link
Author

In the context of streams, the method which I believe makes most sense is deduping sequential elements, not all elements, as this is an operation more suited for doing in a collection. However, deduping sequential elements can be very handy for implementing signal-type interfaces that are only triggered when an element actually changes.

I understand thinking of streams as just the future equivalent of future-backed iterators (because that seems to be the design intent), however, I think they can be slightly more, mainly, well, streams of data that can be altered, filtered, diverted, etc., in ways an iterator might not be.

At least that's my opinion.

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

No branches or pull requests

2 participants