File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -346,8 +346,9 @@ pub struct Receiver<T> {
346346impl < T > Receiver < T > {
347347 /// Receives a message from the channel.
348348 ///
349- /// If the channel is empty and still has senders, this method will wait until a message is
350- /// sent into the channel or until all senders get dropped.
349+ /// If the channel is emtpy and still has senders, this method
350+ /// will wait until a message is sent into it. Once all senders
351+ /// have been dropped it will return `None`.
351352 ///
352353 /// # Examples
353354 ///
@@ -362,10 +363,13 @@ impl<T> Receiver<T> {
362363 /// task::spawn(async move {
363364 /// s.send(1).await;
364365 /// s.send(2).await;
366+ /// // Then we drop the sender
365367 /// });
366368 ///
367369 /// assert_eq!(r.recv().await, Some(1));
368370 /// assert_eq!(r.recv().await, Some(2));
371+ ///
372+ /// // recv() returns `None`
369373 /// assert_eq!(r.recv().await, None);
370374 /// #
371375 /// # })
You can’t perform that action at this time.
0 commit comments