@@ -145,7 +145,7 @@ impl<Effect, Event> CommandContext<Effect, Event> {
145145 // ANCHOR: spawn
146146 pub fn spawn < F , Fut > ( & self , make_future : F ) -> JoinHandle
147147 where
148- F : FnOnce ( CommandContext < Effect , Event > ) -> Fut ,
148+ F : FnOnce ( Self ) -> Fut ,
149149 Fut : Future < Output = ( ) > + Send + ' static ,
150150 {
151151 let ( sender, receiver) = crossbeam_channel:: unbounded ( ) ;
@@ -185,22 +185,21 @@ impl<T: Unpin + Send> ShellStream<T> {
185185 send_request : impl FnOnce ( ) + Send + ' static ,
186186 output_receiver : mpsc:: UnboundedReceiver < T > ,
187187 ) -> Self {
188- ShellStream :: ReadyToSend ( Box :: new ( send_request) , output_receiver)
188+ Self :: ReadyToSend ( Box :: new ( send_request) , output_receiver)
189189 }
190190
191191 fn send ( & mut self ) {
192192 // Since neither part is Clone, we'll need to do an Indiana Jones
193193
194194 // 1. take items out of self
195- let dummy = ShellStream :: Sent ( mpsc:: unbounded ( ) . 1 ) ;
196- let ShellStream :: ReadyToSend ( send_request, output_receiver) =
197- std:: mem:: replace ( self , dummy)
195+ let dummy = Self :: Sent ( mpsc:: unbounded ( ) . 1 ) ;
196+ let Self :: ReadyToSend ( send_request, output_receiver) = std:: mem:: replace ( self , dummy)
198197 else {
199198 unreachable ! ( "cannot send" ) ;
200199 } ;
201200
202201 // 2. replace self with with a Sent using the original receiver
203- * self = ShellStream :: Sent ( output_receiver) ;
202+ * self = Self :: Sent ( output_receiver) ;
204203
205204 send_request ( ) ;
206205 }
@@ -211,15 +210,15 @@ impl<T: Unpin + Send> Stream for ShellStream<T> {
211210
212211 fn poll_next ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Option < Self :: Item > > {
213212 match * self {
214- ShellStream :: ReadyToSend ( _, ref mut output_receiver) => {
213+ Self :: ReadyToSend ( _, ref mut output_receiver) => {
215214 let poll = pin ! ( output_receiver) . poll_next ( cx) ;
216215 assert ! ( matches!( poll, Poll :: Pending ) ) ; // we have not sent the request yet
217216
218217 self . send ( ) ;
219218
220219 Poll :: Pending
221220 }
222- ShellStream :: Sent ( ref mut output_receiver) => pin ! ( output_receiver) . poll_next ( cx) ,
221+ Self :: Sent ( ref mut output_receiver) => pin ! ( output_receiver) . poll_next ( cx) ,
223222 }
224223 }
225224}
0 commit comments