You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on a toy piece of code, I ended up with something that I've boiled down to the following example:
asyncfntest(){use async_std::{stream, prelude::*};let res = stream::from_iter(vec!['a','b','c']).flat_map(|item| stream::from_iter(vec![1,2,3])).flat_map(|item| stream::from_iter(vec![4,5,6])).for_each(|item| ());
res.await;}
This does not work however, as the second invocation of flat_map can not be found on the stream produced by the first invocation. Upon looking at the source, the following bound on FlatMap seems unnecessary and seems to be causing the issue.
The bound S::Item: IntoStream<IntoStream = U, Item = U::Item> states that for a given FlatMap<S, U, F> to be a stream, each item from the original stream S must be convertible to a stream U that produces the output type. This does not seem to be neccesary however, as this is the transformation the provided closure/function F: FnMut(S::Item) -> U performs.
I hope the above makes sense, and please do point me in the right direction if I'm just doing something horribly wrong.
The text was updated successfully, but these errors were encountered:
While working on a toy piece of code, I ended up with something that I've boiled down to the following example:
This does not work however, as the second invocation of
flat_map
can not be found on the stream produced by the first invocation. Upon looking at the source, the following bound onFlatMap
seems unnecessary and seems to be causing the issue.The bound
S::Item: IntoStream<IntoStream = U, Item = U::Item>
states that for a givenFlatMap<S, U, F>
to be a stream, each item from the original streamS
must be convertible to a streamU
that produces the output type. This does not seem to be neccesary however, as this is the transformation the provided closure/functionF: FnMut(S::Item) -> U
performs.I hope the above makes sense, and please do point me in the right direction if I'm just doing something horribly wrong.
The text was updated successfully, but these errors were encountered: