Does anyone have an example of going from an Iterator of type Result<T, SomeError> to Iterator of type T, while handling all errors? I can see how this could be done with `for x in y` syntax, but I'm wondering if this can be done using combinators. Can it?
Oops, I should've clarified: I don't mean "all errors". I mean: "keep forwarding input into a new stream, but exit on the first error". Also without buffering.
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Yeah, if you just want to do a thing for each item, try_for_each is what you want. If you want to continue method chaining, It does seem like https://docs.rs/try_map/0.3.1/try_map/trait.FallibleMapExt.html … (or something similar) would be what you want. So: get_some_res_stream() .try_map(...)? .map() .map()
-
Hmm, at the risk of sounding like a broken record: wouldn't try_map still also have to do internal buffering? e.g. it can't return a Result until all items have been iterated over -- which means in the case of an infinite iterator it either OOMs or runs into an error.
- 2 more replies
New conversation -
-
-
no idea how to best do this without buffering but since i also misunderstood your original question, here's both of the simple approaches: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7a7270c5998c3772a3bfab893356ca26 …
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
