I want to write a small factorial library. Please look at the code inside the main module of the library:
pub fn results() -> const [i8; 6] { [
1,
1,
2,
6,
24,
120,
//720 is too large for i8.
] }
pub fn results() -> const [i32; 13] { [
1,
1,
2,
6,
24,
120,
720,
5_040,
40_320,
362_880,
3_628_800,
39_916_800,
479_001_600,
//6_227_020_800 is too large for i32.
] }
It gives me this error for the return type of the first function:
error: expected type, found keyword `const`
--> src/main.rs:1:21
|
1 | pub fn results() -> const [i8; 6] { [
| ^^^^^
The goal is to get an array of all possible factorial values at compile time.