dmccloskey commented on PR #660:
URL: 
https://github.com/apache/arrow-rs-object-store/pull/660#issuecomment-4068705468

   > I don't usually work at the poll_next level; it's much too confusing for 
90% of work that you can get done with higher level constructs.
   I agree 💯😄
   
   > That said, I think you might want your stream to itself have a 'static 
lifetime
   Sorry the `'a` lifetimes were a typo on my side.
   
   ```
   pub struct MyStream {
       pub store: Option<Arc<dyn ObjectStore>>,
       pub path: Option<Path>,
       pub state: Option<Pin<Box<dyn Future<Output = Result<GetResult, 
object_store::Error>> + Send + 'static>>>
       ...
   }
   
   impl Stream for MyStream {
       type Item = Result<Bytes>;
   
       fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> 
Poll<Option<Self::Item>> {
           ...
           let store = self.store.as_ref().unwrap().clone();
           let path = self.path.clone();
           let fut = Box::pin( store.get(&path));
                                       ^^^^"...cannot outlive `static...."
           self.state.replace(fut);
           self.poll_next(cx)
       ...
       }
   }
   ```


-- 
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