1
1
//! A single-producer, single-consumer (oneshot) channel.
2
- //!
3
- //! TODO more docs.
4
2
5
3
use crate :: sync:: mpmc;
6
4
use crate :: sync:: mpsc:: { RecvError , SendError } ;
7
5
use crate :: time:: { Duration , Instant } ;
8
6
use crate :: { error, fmt} ;
9
7
10
8
/// Creates a new oneshot channel, returning the sender/receiver halves.
11
- ///
12
- /// TODO more docs.
13
9
#[ must_use]
14
10
#[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
15
11
pub fn channel < T > ( ) -> ( Sender < T > , Receiver < T > ) {
@@ -22,8 +18,6 @@ pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
22
18
////////////////////////////////////////////////////////////////////////////////////////////////////
23
19
24
20
/// The sending half of a oneshot channel.
25
- ///
26
- /// TODO more docs.
27
21
#[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
28
22
pub struct Sender < T > {
29
23
/// The `oneshot` channel is simply a wrapper around a `mpmc` channel.
@@ -62,8 +56,6 @@ impl<T> fmt::Debug for Sender<T> {
62
56
////////////////////////////////////////////////////////////////////////////////////////////////////
63
57
64
58
/// The receiving half of a oneshot channel.
65
- ///
66
- /// TODO more docs.
67
59
#[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
68
60
pub struct Receiver < T > {
69
61
/// The `oneshot` channel is simply a wrapper around a `mpmc` channel.
@@ -91,8 +83,6 @@ impl<T> Receiver<T> {
91
83
// Fallable methods.
92
84
93
85
/// Attempts to return a pending value on this receiver without blocking.
94
- ///
95
- /// TODO examples.
96
86
#[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
97
87
pub fn try_recv ( self ) -> Result < T , TryRecvError < T > > {
98
88
self . inner . try_recv ( ) . map_err ( |err| match err {
@@ -103,8 +93,6 @@ impl<T> Receiver<T> {
103
93
104
94
/// Attempts to wait for a value on this receiver, returning an error if the corresponding
105
95
/// [`Sender`] half of this channel has been dropped, or if it waits more than `timeout`.
106
- ///
107
- /// TODO examples.
108
96
#[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
109
97
pub fn recv_timeout ( self , timeout : Duration ) -> Result < T , RecvTimeoutError < T > > {
110
98
self . inner . recv_timeout ( timeout) . map_err ( |err| match err {
@@ -115,8 +103,6 @@ impl<T> Receiver<T> {
115
103
116
104
/// Attempts to wait for a value on this receiver, returning an error if the corresponding
117
105
/// [`Sender`] half of this channel has been dropped, or if `deadline` is reached.
118
- ///
119
- /// TODO examples.
120
106
#[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
121
107
pub fn recv_deadline ( self , deadline : Instant ) -> Result < T , RecvTimeoutError < T > > {
122
108
self . inner . recv_deadline ( deadline) . map_err ( |err| match err {
0 commit comments