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
this commit introduces a method that can be used to inquire whether a
oneshot channel's receiver has or has not yielded a value.
this is useful for callers that may be polling the receiver as a future,
to avoid inducing a panic. the receiver panics if polled after yielding
a `Poll::Ready<T>`. note that this is acceptable, per the
`Future::poll()` documentation regarding panics:
> Once a future has completed (returned Ready from poll), calling its
poll method again may panic, block forever, or cause other kinds of
problems; the Future trait places no requirements on the effects of such
a call.
NB: this commit makes one somewhat noteworthy change to the
implementation of `<Receiver<T> as Future>::poll()`. the inner state is
now taken when an error is yielded. this also follows the rules
proscribed by `std::future::Future::poll()`, to be clear!
the upside of this is that it means a broken or closed channel, e.g.
when the sender is dropped, will settle as "finished" after it yields an
error.
see: <https://doc.rust-lang.org/stable/std/future/trait.Future.html#panics>.
Signed-off-by: katelyn martin <[email protected]>
0 commit comments