Closed notgull closed 6 months ago
Thanks. I think this is much clearer than the previous one, but I would like to hear @smol-rs/admins's opinions.
Thanks. I think this is much clearer than the previous one
Although I agree but seems the current name was chosen for consistency with std:
/// This is intended to be used as a way of polling a stream without waiting, similar to the /// [
try_iter
] function on [std::sync::mpsc::Receiver
]. For instance, running this stream /// on an [async_channel::Receiver
] will return all messages that are currently in the /// channel, but will not wait for new messages.
If we do this, we should probably do it in a backwards-compatible way using type aliases.
If we do this, we should probably do it in a backwards-compatible way using type aliases.
That is not necessary because the old name has not been released. (See https://github.com/smol-rs/futures-lite/pull/94 for the context of this PR.)
/// This is intended to be used as a way of polling a stream without waiting, similar to the /// [
try_iter
] function on [std::sync::mpsc::Receiver
]. For instance, running this stream /// on an [async_channel::Receiver
] will return all messages that are currently in the /// channel, but will not wait for new messages.
Unfortunately it's not really an Iterator
so we can't name it that.
Unfortunately it's not really an
Iterator
so we can't name it that.
I wasn't suggesting we name it an iterator. That was quoting the existing docs, which justify the try_stream
name for consistency with std.
I wasn't suggesting we name it an iterator. That was quoting the existing docs, which justify the
try_stream
name for consistency with std.
The issue with that is that TryStream
is already a taken name in futures
, and I think naming the combinator this would cause confusion. Hence the change to Drain
.
how does this compare to futures
' TryStream
then?
how does this compare to
futures
'TryStream
then?
Mostly unrelated. TryStream
is a Stream
that returns a Result
, while Drain
is a Stream
combinator that returns as many elements that can be returned as possible without waiting.
ok, then I side with you that try_stream
is unfortunate naming.
At the suggestion of @i509vcb