-
Notifications
You must be signed in to change notification settings - Fork 671
Description
I have been familiarizing myself with Streams since my project at work makes heavy use of iterations that involve async I/O (such as transforming datasets containing transformations that require API calls to resolve). One thing I noticed was that, unlike sync iterators, streams require you to use .try_collect to collect into a Result. I found the following reply to an issue discussing the same topic from before async fn in traits was stabilized:
Collecting into a
Result<Collection<_>, _>specifically can be done viatry_collect.It could be possible to add a trait like
FromStreamas an equivalent toFromIteratorto use instead ofDefault + Extend, but that would want to involveasync fn-in-traits, which is not possible today (you can see thatasync-std::stream::FromStreamforces boxing of the future and isn'tSend, which would be unacceptable long term.
Originally posted by @Nemo157 in #1988
Is there still a blocker to allowing StreamExt::collect to collect into a Result?