@@ -1223,53 +1223,6 @@ where
12231223 }
12241224}
12251225
1226- enum ReceiverWaker {
1227- /// The receiver is waiting synchronously. Its thread is parked.
1228- #[ cfg( feature = "std" ) ]
1229- Thread ( thread:: Thread ) ,
1230- /// The receiver is waiting asynchronously. Its task can be woken up with this `Waker`.
1231- #[ cfg( feature = "async" ) ]
1232- Task ( task:: Waker ) ,
1233- /// A little hack to not make this enum an uninhibitable type when no features are enabled.
1234- #[ cfg( not( any( feature = "async" , feature = "std" ) ) ) ]
1235- _Uninhabited,
1236- }
1237-
1238- impl ReceiverWaker {
1239- #[ cfg( feature = "std" ) ]
1240- pub fn current_thread ( ) -> Self {
1241- Self :: Thread ( thread:: current ( ) )
1242- }
1243-
1244- #[ cfg( feature = "async" ) ]
1245- pub fn task_waker ( cx : & task:: Context < ' _ > ) -> Self {
1246- Self :: Task ( cx. waker ( ) . clone ( ) )
1247- }
1248-
1249- pub fn unpark ( self ) {
1250- match self {
1251- #[ cfg( feature = "std" ) ]
1252- ReceiverWaker :: Thread ( thread) => thread. unpark ( ) ,
1253- #[ cfg( feature = "async" ) ]
1254- ReceiverWaker :: Task ( waker) => waker. wake ( ) ,
1255- #[ cfg( not( any( feature = "async" , feature = "std" ) ) ) ]
1256- ReceiverWaker :: _Uninhabited => unreachable ! ( ) ,
1257- }
1258- }
1259- }
1260-
1261- #[ cfg( not( loom) ) ]
1262- #[ test]
1263- fn receiver_waker_size ( ) {
1264- let expected: usize = match ( cfg ! ( feature = "std" ) , cfg ! ( feature = "async" ) ) {
1265- ( false , false ) => 0 ,
1266- ( false , true ) => 16 ,
1267- ( true , false ) => 8 ,
1268- ( true , true ) => 16 ,
1269- } ;
1270- assert_eq ! ( mem:: size_of:: <ReceiverWaker >( ) , expected) ;
1271- }
1272-
12731226#[ cfg( all( feature = "std" , feature = "async" ) ) ]
12741227const RECEIVER_USED_SYNC_AND_ASYNC_ERROR : & str =
12751228 "Invalid to call a blocking receive method on oneshot::Receiver after it has been polled" ;
0 commit comments