I want to create an array called minutes: [&'static str; 60]
that contains the "stringified" values from 1 to 59. So far I got:
pub const fn minutes_as_str() -> [&'static str; 60] {
(1 ..= 59).map(|c| c.to_string()).collect()
}
However the collect()
won't work with such iterator. I tried using a for loop too but the BC gets in the way:
pub const fn minutes_as_str() -> [&'static str; 60] {
let mut result = [""; 60];
for n in 1 ..= 59 {
result[n] = &n.to_string(); // BC failure
}
result
}