1+ #![ allow( deprecated) ]
2+
13use std:: cell:: UnsafeCell ;
24use std:: error:: Error ;
35use std:: fmt:: { self , Debug , Display } ;
@@ -32,6 +34,7 @@ use crate::sync::WakerSet;
3234/// # Examples
3335///
3436/// ```
37+ /// #![allow(deprecated)]
3538/// # fn main() -> Result<(), async_std::sync::RecvError> {
3639/// # async_std::task::block_on(async {
3740/// #
@@ -60,6 +63,7 @@ use crate::sync::WakerSet;
6063/// ```
6164#[ cfg( feature = "unstable" ) ]
6265#[ cfg_attr( feature = "docs" , doc( cfg( unstable) ) ) ]
66+ #[ deprecated = "new channel api at async_std::channel" ]
6367pub fn channel < T > ( cap : usize ) -> ( Sender < T > , Receiver < T > ) {
6468 let channel = Arc :: new ( Channel :: with_capacity ( cap) ) ;
6569 let s = Sender {
@@ -82,6 +86,7 @@ pub fn channel<T>(cap: usize) -> (Sender<T>, Receiver<T>) {
8286/// # Examples
8387///
8488/// ```
89+ /// #![allow(deprecated)]
8590/// # async_std::task::block_on(async {
8691/// #
8792/// use async_std::sync::channel;
@@ -102,6 +107,7 @@ pub fn channel<T>(cap: usize) -> (Sender<T>, Receiver<T>) {
102107/// ```
103108#[ cfg( feature = "unstable" ) ]
104109#[ cfg_attr( feature = "docs" , doc( cfg( unstable) ) ) ]
110+ #[ deprecated = "new channel api at async_std::channel" ]
105111pub struct Sender < T > {
106112 /// The inner channel.
107113 channel : Arc < Channel < T > > ,
@@ -115,6 +121,7 @@ impl<T> Sender<T> {
115121 /// # Examples
116122 ///
117123 /// ```
124+ /// #![allow(deprecated)]
118125 /// # fn main() -> Result<(), async_std::sync::RecvError> {
119126 /// # async_std::task::block_on(async {
120127 /// #
@@ -204,6 +211,7 @@ impl<T> Sender<T> {
204211 /// # Examples
205212 ///
206213 /// ```
214+ /// #![allow(deprecated)]
207215 /// # async_std::task::block_on(async {
208216 /// #
209217 /// use async_std::sync::channel;
@@ -223,6 +231,7 @@ impl<T> Sender<T> {
223231 /// # Examples
224232 ///
225233 /// ```
234+ /// #![allow(deprecated)]
226235 /// use async_std::sync::channel;
227236 ///
228237 /// let (s, _) = channel::<i32>(5);
@@ -237,6 +246,7 @@ impl<T> Sender<T> {
237246 /// # Examples
238247 ///
239248 /// ```
249+ /// #![allow(deprecated)]
240250 /// # async_std::task::block_on(async {
241251 /// #
242252 /// use async_std::sync::channel;
@@ -258,6 +268,7 @@ impl<T> Sender<T> {
258268 /// # Examples
259269 ///
260270 /// ```
271+ /// #![allow(deprecated)]
261272 /// # async_std::task::block_on(async {
262273 /// #
263274 /// use async_std::sync::channel;
@@ -279,6 +290,7 @@ impl<T> Sender<T> {
279290 /// # Examples
280291 ///
281292 /// ```
293+ /// #![allow(deprecated)]
282294 /// # async_std::task::block_on(async {
283295 /// #
284296 /// use async_std::sync::channel;
@@ -339,6 +351,7 @@ impl<T> fmt::Debug for Sender<T> {
339351/// # Examples
340352///
341353/// ```
354+ /// #![allow(deprecated)]
342355/// # fn main() -> Result<(), async_std::sync::RecvError> {
343356/// # async_std::task::block_on(async {
344357/// #
@@ -363,6 +376,7 @@ impl<T> fmt::Debug for Sender<T> {
363376/// ```
364377#[ cfg( feature = "unstable" ) ]
365378#[ cfg_attr( feature = "docs" , doc( cfg( unstable) ) ) ]
379+ #[ deprecated = "new channel api at async_std::channel" ]
366380pub struct Receiver < T > {
367381 /// The inner channel.
368382 channel : Arc < Channel < T > > ,
@@ -381,6 +395,7 @@ impl<T> Receiver<T> {
381395 /// # Examples
382396 ///
383397 /// ```
398+ /// #![allow(deprecated)]
384399 /// # fn main() -> Result<(), async_std::sync::RecvError> {
385400 /// # async_std::task::block_on(async {
386401 /// #
@@ -444,6 +459,7 @@ impl<T> Receiver<T> {
444459 /// # Examples
445460 ///
446461 /// ```
462+ /// #![allow(deprecated)]
447463 /// # async_std::task::block_on(async {
448464 /// #
449465 /// use async_std::sync::channel;
@@ -466,6 +482,7 @@ impl<T> Receiver<T> {
466482 /// # Examples
467483 ///
468484 /// ```
485+ /// #![allow(deprecated)]
469486 /// use async_std::sync::channel;
470487 ///
471488 /// let (_, r) = channel::<i32>(5);
@@ -480,6 +497,7 @@ impl<T> Receiver<T> {
480497 /// # Examples
481498 ///
482499 /// ```
500+ /// #![allow(deprecated)]
483501 /// # async_std::task::block_on(async {
484502 /// #
485503 /// use async_std::sync::channel;
@@ -501,6 +519,7 @@ impl<T> Receiver<T> {
501519 /// # Examples
502520 ///
503521 /// ```
522+ /// #![allow(deprecated)]
504523 /// # async_std::task::block_on(async {
505524 /// #
506525 /// use async_std::sync::channel;
@@ -522,6 +541,7 @@ impl<T> Receiver<T> {
522541 /// # Examples
523542 ///
524543 /// ```
544+ /// #![allow(deprecated)]
525545 /// # async_std::task::block_on(async {
526546 /// #
527547 /// use async_std::sync::channel;
@@ -993,6 +1013,7 @@ impl<T> Drop for Channel<T> {
9931013#[ cfg( feature = "unstable" ) ]
9941014#[ cfg_attr( feature = "docs" , doc( cfg( unstable) ) ) ]
9951015#[ derive( PartialEq , Eq ) ]
1016+ #[ deprecated = "new channel api at async_std::channel" ]
9961017pub enum TrySendError < T > {
9971018 /// The channel is full but not disconnected.
9981019 Full ( T ) ,
@@ -1025,6 +1046,7 @@ impl<T> Display for TrySendError<T> {
10251046#[ cfg( feature = "unstable" ) ]
10261047#[ cfg_attr( feature = "docs" , doc( cfg( unstable) ) ) ]
10271048#[ derive( Debug , PartialEq , Eq ) ]
1049+ #[ deprecated = "new channel api at async_std::channel" ]
10281050pub enum TryRecvError {
10291051 /// The channel is empty but not disconnected.
10301052 Empty ,
@@ -1048,6 +1070,7 @@ impl Display for TryRecvError {
10481070#[ cfg( feature = "unstable" ) ]
10491071#[ cfg_attr( feature = "docs" , doc( cfg( unstable) ) ) ]
10501072#[ derive( Debug , PartialEq , Eq ) ]
1073+ #[ deprecated = "new channel api at async_std::channel" ]
10511074pub struct RecvError ;
10521075
10531076impl Error for RecvError { }
0 commit comments