File tree 1 file changed +6
-2
lines changed
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> {
346
346
impl < T > Receiver < T > {
347
347
/// Receives a message from the channel.
348
348
///
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`.
351
352
///
352
353
/// # Examples
353
354
///
@@ -362,10 +363,13 @@ impl<T> Receiver<T> {
362
363
/// task::spawn(async move {
363
364
/// s.send(1).await;
364
365
/// s.send(2).await;
366
+ /// // Then we drop the sender
365
367
/// });
366
368
///
367
369
/// assert_eq!(r.recv().await, Some(1));
368
370
/// assert_eq!(r.recv().await, Some(2));
371
+ ///
372
+ /// // recv() returns `None`
369
373
/// assert_eq!(r.recv().await, None);
370
374
/// #
371
375
/// # })
You can’t perform that action at this time.
0 commit comments