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

   > @kylebarron Thanks for your response.
   > 
   > 1. Some issue with line endings apparently
   > 2. Perhaps I am just doing something incorrect then. My use case is the 
following:
   > 
   > ```
   > 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<'a> Stream for MyStream<'a> {
   >     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)
   >     ...
   >     }
   > }
   > ```
   > 
   > 3. Gotcha
   
   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.
   
   That said, I think you might want your stream to itself have a `'static` 
lifetime


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