tustvold commented on issue #5116:
URL: https://github.com/apache/arrow-rs/issues/5116#issuecomment-1823651737

   So the issue here is tonic is imposing a 'static lifetime bound on the 
returned stream, which is likely a historical artifact from when GATs were not 
supported.
   
   You have a couple of options here:
   
   ```
   let meta: Vec<_> = context.object_store.list(prefix).try_collect().await?;
   let stream = futures::stream::iter(meta);
   ```
   
   ```
   let (sender, receiver) = mpsc::channel(2);
   tokio::spawn(async move {
       let mut stream = context.object_store.list(prefix);
       while let Some(n) = stream.next().transpose().await? {
           if sender.send(n).is_err() {
               break
           }
       }    
   })
   let stream = receiver;
   ```
   
   Otherwise you will need to use something like 
https://docs.rs/ouroboros/latest/ouroboros/index.html to construct a 
self-referential stream.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to