Skip to content

Commit

Permalink
Add Receiver::try_next return type descriptions
Browse files Browse the repository at this point in the history
Similar change applied to `UnboundedReceiver::try_next` a few commits ago.
  • Loading branch information
stepancheg committed Mar 1, 2021
1 parent 4d2ad0e commit 8476bb3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions futures-channel/src/mpsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,11 @@ impl<T> Receiver<T> {
/// It is not recommended to call this function from inside of a future,
/// only when you've otherwise arranged to be notified when the channel is
/// no longer empty.
///
/// This function returns:
/// * `Ok(Some(t))` when message is fetched
/// * `Ok(None)` when channel is closed and no messages left in the queue
/// * `Err(e)` when there are no messages available, but channel is not yet closed
pub fn try_next(&mut self) -> Result<Option<T>, TryRecvError> {
match self.next_message() {
Poll::Ready(msg) => {
Expand Down

0 comments on commit 8476bb3

Please sign in to comment.