kylebarron opened a new issue, #6587: URL: https://github.com/apache/arrow-rs/issues/6587
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** I'm writing a new Python binding for the `object-store` crate (differences from the existing one [detailed here](https://github.com/roeap/object-store-python/issues/24#issuecomment-2422689636)). I'm trying to present streaming APIs to the user instead of materializing an entire result stream upfront. This [_worked_ for `get`](https://github.com/developmentseed/object-store-rs/pull/11), where we can expose the `stream` returned by `GetResult::into_stream` as a Python async iterable. When I [tried](https://github.com/developmentseed/object-store-rs/pull/13) to do present a streaming result API for `list`, I tried to cast the result of `ObjectStore::list` to ```rs let stream: BoxStream<'static, object_store::Result<ObjectMeta>> = store.list(prefix); ``` and got that the `store` does not live long enough. ``` error[E0597]: `store` does not live long enough --> object-store-rs/src/list.rs:175:18 | 168 | store: PyObjectStore, | ----- binding `store` declared here ... 175 | let stream = store.as_ref().list(prefix.map(|s| s.into()).as_ref()); | ^^^^^ borrowed value does not live long enough 176 | let stream2: BoxStream<'static, object_store::Result<ObjectMeta>> = stream; | ---------------------------------------------------- type annotation requires that `store` is borrowed for `'static` ... 189 | } | - `store` dropped here while still borrowed ``` It's [not possible to use a lifetime](https://pyo3.rs/v0.22.5/class.html#no-lifetime-parameters) other than `'static` in a struct exported to Python, so I'm not sure if it's possible to wrap `list` as a stream currently. @tustvold mentioned in discord that it may be possible to change other methods to use `'static` in the next major object-store release. **Describe the solution you'd like** The most straightforward solution would be to change the `ObjectStore` trait to use the `'static` lifetime. But I'm open to other solutions. I don't fully understand async lifetimes well enough to know all the implications here. **Describe alternatives you've considered** **Additional context** -- 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]
