@@ -182,6 +182,11 @@ impl<S> Lighthouse<S>
182182 self . perform ( & Verb :: Unlink , dest_path, src_path) . await
183183 }
184184
185+ /// Stops the given stream.
186+ pub async fn stop ( & mut self , path : & [ & str ] ) -> Result < ServerMessage < ( ) > > {
187+ self . perform ( & Verb :: Stop , path, ( ) ) . await
188+ }
189+
185190 /// Performs a single request to the given path with the given payload.
186191 #[ tracing:: instrument( skip( self , payload) ) ]
187192 pub async fn perform < P , R > ( & mut self , verb : & Verb , path : & [ & str ] , payload : P ) -> Result < ServerMessage < R > >
@@ -202,6 +207,7 @@ impl<S> Lighthouse<S>
202207 R : for < ' de > Deserialize < ' de > {
203208 let request_id = self . send_request ( & Verb :: Stream , path, payload) . await ?;
204209 let stream = self . receive_streaming ( request_id) . await ?;
210+ // TODO: Send STOP once dropped
205211 Ok ( stream)
206212 }
207213
@@ -245,9 +251,7 @@ impl<S> Lighthouse<S>
245251 async fn receive_streaming < R > ( & self , request_id : i32 ) -> Result < impl Stream < Item = Result < ServerMessage < R > > > >
246252 where
247253 R : for < ' de > Deserialize < ' de > {
248- // TODO: Add a stream guard that sends a STOP
249-
250- Ok ( self . receive ( request_id) . await ?)
254+ self . receive ( request_id) . await
251255 }
252256
253257 async fn receive < R > ( & self , request_id : i32 ) -> Result < impl Stream < Item = Result < ServerMessage < R > > > >
0 commit comments