Closed avitex closed 1 year ago
Technically, you can do:
use futures_lite::stream::{once, StreamExt};
let my_fut = async { /* ... */ };
let stream = once(()).then(move |()| my_fut);
But this seems like an antipattern. I like this idea, although I'd rather see it as a combinator on the Future
type, like into_stream()
?
In futures there is
stream::once
which allows creating a stream from a future. I would argue it generic enough and simple enough to warrant it being functionality provided in this library.Would a
stream::future
or similar named function be accepted with a PR?