Closed notgull closed 1 year ago
Why does this add both freestanding function and method?
I assumed that was the status quo for futures_lite
, like how zip
and or
are methods.
I guess it is only happening with methods that take two or more futures/streams. (e.g., catch_unwind is trait method only)
There has been discussion in the past in futures
that freestanding functions are preferred for such methods: https://github.com/rust-lang/futures-rs/issues/1215
It seems you have removed the trait method, but I have the impression that into_
is a prefix that is often used in the method (e.g., String::into_bytes
, {BufReader,BufWriter}::into_inner)
.
You're right. How would you feel about just the name stream()
?
Maybe stream::from_future
?
That said, I have no strong opinion on this as I tend to prefer the futures
's APIs that take the future as an argument (i.e., I think stream::once
is the ideal name here).
@smol-rs/admins: Any thoughts on the API here?
@smol-rs/admins: Any thoughts on the API here?
I agree with you about the naming. stream::once
seems better to me as well.
I like the idea of stream::once
, however, that method already exits and just yields a single value without being asynchronous. I renamed this type to stream::once_future()
.
Yes, the idea is to give the user the ability to turn a Future
into a Stream
.
this should be squash-merged.
Resolves #52