@@ -138,25 +138,22 @@ impl<T, U> Clone for UnboundedSender<T, U> {
138
138
}
139
139
}
140
140
141
- #[ pin_project:: pin_project( PinnedDrop ) ]
142
141
pub ( crate ) struct Receiver < T , U > {
143
- #[ pin]
144
142
inner : mpsc:: UnboundedReceiver < Envelope < T , U > > ,
145
143
taker : want:: Taker ,
146
144
}
147
145
148
146
impl < T , U > Receiver < T , U > {
149
- pub ( crate ) fn poll_next (
150
- self : Pin < & mut Self > ,
147
+ pub ( crate ) fn poll_recv (
148
+ & mut self ,
151
149
cx : & mut task:: Context < ' _ > ,
152
150
) -> Poll < Option < ( T , Callback < T , U > ) > > {
153
- let mut this = self . project ( ) ;
154
- match this. inner . poll_recv ( cx) {
151
+ match self . inner . poll_recv ( cx) {
155
152
Poll :: Ready ( item) => {
156
153
Poll :: Ready ( item. map ( |mut env| env. 0 . take ( ) . expect ( "envelope not dropped" ) ) )
157
154
}
158
155
Poll :: Pending => {
159
- this . taker . want ( ) ;
156
+ self . taker . want ( ) ;
160
157
Poll :: Pending
161
158
}
162
159
}
@@ -177,12 +174,11 @@ impl<T, U> Receiver<T, U> {
177
174
}
178
175
}
179
176
180
- #[ pin_project:: pinned_drop]
181
- impl < T , U > PinnedDrop for Receiver < T , U > {
182
- fn drop ( mut self : Pin < & mut Self > ) {
177
+ impl < T , U > Drop for Receiver < T , U > {
178
+ fn drop ( & mut self ) {
183
179
// Notify the giver about the closure first, before dropping
184
180
// the mpsc::Receiver.
185
- self . as_mut ( ) . taker . cancel ( ) ;
181
+ self . taker . cancel ( ) ;
186
182
}
187
183
}
188
184
@@ -279,8 +275,8 @@ mod tests {
279
275
impl < T , U > Future for Receiver < T , U > {
280
276
type Output = Option < ( T , Callback < T , U > ) > ;
281
277
282
- fn poll ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self :: Output > {
283
- self . poll_next ( cx)
278
+ fn poll ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Self :: Output > {
279
+ self . poll_recv ( cx)
284
280
}
285
281
}
286
282
0 commit comments