11//! A single-producer, single-consumer (oneshot) channel.
2- //!
3- //! TODO more docs.
42
53use crate :: sync:: mpmc;
64use crate :: sync:: mpsc:: { RecvError , SendError } ;
75use crate :: time:: { Duration , Instant } ;
86use crate :: { error, fmt} ;
97
108/// Creates a new oneshot channel, returning the sender/receiver halves.
11- ///
12- /// TODO more docs.
139#[ must_use]
1410#[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
1511pub fn channel < T > ( ) -> ( Sender < T > , Receiver < T > ) {
@@ -22,8 +18,6 @@ pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
2218////////////////////////////////////////////////////////////////////////////////////////////////////
2319
2420/// The sending half of a oneshot channel.
25- ///
26- /// TODO more docs.
2721#[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
2822pub struct Sender < T > {
2923 /// The `oneshot` channel is simply a wrapper around a `mpmc` channel.
@@ -62,8 +56,6 @@ impl<T> fmt::Debug for Sender<T> {
6256////////////////////////////////////////////////////////////////////////////////////////////////////
6357
6458/// The receiving half of a oneshot channel.
65- ///
66- /// TODO more docs.
6759#[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
6860pub struct Receiver < T > {
6961 /// The `oneshot` channel is simply a wrapper around a `mpmc` channel.
@@ -91,8 +83,6 @@ impl<T> Receiver<T> {
9183 // Fallable methods.
9284
9385 /// Attempts to return a pending value on this receiver without blocking.
94- ///
95- /// TODO examples.
9686 #[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
9787 pub fn try_recv ( self ) -> Result < T , TryRecvError < T > > {
9888 self . inner . try_recv ( ) . map_err ( |err| match err {
@@ -103,8 +93,6 @@ impl<T> Receiver<T> {
10393
10494 /// Attempts to wait for a value on this receiver, returning an error if the corresponding
10595 /// [`Sender`] half of this channel has been dropped, or if it waits more than `timeout`.
106- ///
107- /// TODO examples.
10896 #[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
10997 pub fn recv_timeout ( self , timeout : Duration ) -> Result < T , RecvTimeoutError < T > > {
11098 self . inner . recv_timeout ( timeout) . map_err ( |err| match err {
@@ -115,8 +103,6 @@ impl<T> Receiver<T> {
115103
116104 /// Attempts to wait for a value on this receiver, returning an error if the corresponding
117105 /// [`Sender`] half of this channel has been dropped, or if `deadline` is reached.
118- ///
119- /// TODO examples.
120106 #[ unstable( feature = "oneshot_channel" , issue = "143674" ) ]
121107 pub fn recv_deadline ( self , deadline : Instant ) -> Result < T , RecvTimeoutError < T > > {
122108 self . inner . recv_deadline ( deadline) . map_err ( |err| match err {
0 commit comments