use futures::{future::BoxFuture, FutureExt}; // 0.3.6
struct Inner {}
impl Inner {
async fn foo3(&self) -> Result<u32, ()> {
Ok(8)
}
}
struct Outer {
i: Inner,
}
impl Outer {
fn foo4(&mut self) -> BoxFuture<'static, Result<u32, ()>> {
self.i.foo3().boxed()
}
}
error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
--> src/lib.rs:17:16
|
16 | fn foo4(&mut self) -> BoxFuture<'static, Result<u32, ()>> {
| --------- this data with an anonymous lifetime `'_`...
17 | self.i.foo3().boxed()
| -------^^^^---------- ...is captured and required to live as long as `'static` here
I notice that I can specify a lifetime for BoxFuture
; instead of passing 'static
, what else can I pass to make this code compile?