我有一个带函数成员的结构。
struct Foo<T> {
fun: Box<dyn Fn(T)>,
}
type FooI = Foo<&mut i32>;
这样做是行不通的
error[E0106]: missing lifetime specifier
--> src/main.rs:5:17
|
5 | type FooI = Foo<&mut i32>;
| ^ expected named lifetime parameter
|
help: consider introducing a named lifetime parameter
|
5 | type FooI<'a> = Foo<&'a mut i32>;
但我不想让FooI在T的生命周期内被参数化 我只想让T的实例比Foo. fun的调用更久一些 我怎么编码呢?