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

StreamExt::scan lacks a non-Option version #2860

Open
sxlijin opened this issue May 15, 2024 · 0 comments
Open

StreamExt::scan lacks a non-Option version #2860

sxlijin opened this issue May 15, 2024 · 0 comments

Comments

@sxlijin
Copy link

sxlijin commented May 15, 2024

My use case is this: given an incoming data stream, I want to provide a stream to the user consisting of the accumulated data stream, so ["lorem", "ipsum", "dolor"] would become ["lorem", "lorem ipsum", "lorem ipsum dolor"].

The currently implementation of StreamExt::scan makes this less ergonomic than is ideal, because I need to wrap everything in Some().

In addition, if I want the stream's entries to be Result<Foo>, and I want to unwrap the Err variant in one scan iteration, I can't use ? shorthand.

This feels a bit like scan should actually be named filter_scan, much like how map and filter_map are the non-Option and Option versions of each other.

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

No branches or pull requests

1 participant