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.
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 inSome()
.In addition, if I want the stream's entries to be
Result<Foo>
, and I want to unwrap theErr
variant in onescan
iteration, I can't use?
shorthand.This feels a bit like
scan
should actually be namedfilter_scan
, much like howmap
andfilter_map
are the non-Option and Option versions of each other.