futures-channel: ensure `is_terminated()` reflects the state of the channel
I noticed that is_terminated() returns true only after a None value has been observed from the stream. The documentation ofFusedStream allows this method to return true earlier, if the stream can no longer make progress:
Usually, this state occurs after
poll_next(ortry_poll_next) returnedPoll::Ready(None). However,is_terminatedmay also returntrueif a stream has become inactive and can no longer make progress and should be ignored or dropped rather than being polled again.
This PR was prompted by a use case that wants to see if the channel has more things to give out without actually pulling them out of the stream since the place of checking is not the right place to handle a potential element from the stream.
This effectively makes .is_terminated() behave like tokio::sync::mpsc::UnboundedReceiver::is_closed().