Closed rcelha closed 1 year ago
This PR/Fork saved me big time just now!
I wanted to iterate over a tree structure whose nodes are fetched asynchroniously from persistent storage. Needless to say, this results in quite the combination of nesting of Box, Future and trait objects of an iterator/stream-like trait.
Essentially, whenever you'd want to write something close to std::async_iterator::AsyncIterator
or futures_core::stream::Stream
you end up in a situation in which you are building a trait that:
&self
or &mut self
, necessitating + Send + Sync bounds.flat_map()
, map().flatten()
, etc.flat_map
also needs to be Send + Sync
.Sync
bound!I am glad it helped someone else as well @Qqwy !
Hey,
I ran into the issue where some of my futures must be
Send + Sync
, browsing the issue tracker I've found https://github.com/dtolnay/async-trait/issues/77 too.Is this something you would be willing to accept contribution to? If that is the case, I'd love to discuss the best approach.
This PR is a draft/proposal on how we can solve this issue. I don´t particularly like my implementation tho, but once we agree on an API I can polish the implementation.
The API I am using here is as follows:
Thanks