爲什麼Rust編譯器發出一個錯誤,要求我限制下列結構中泛型參數的生存期? pub struct NewType<'a, T> {
x: &'a T,
}
error[E0309]: the parameter type `T` may not live long enough
--> src/main.rs:2:5
|
2 | x: &'a T,
| ^
我使用這個循環,產生月 i = 1
Do While i <= 12
ListedMonths.Add(New ListedMonth(i, MonthName(i)))
i = i + 1
Loop
Return ListedMonths
的清單,但我也想顯示在頂部一月前的空白選項。 我曾嘗試加入ListedMonths.Ad