you can directly do explicit type conversion (casting) can be performed using the as keyword.
fn fib(n: i32) -> i32 {
if n < 2 {
return n;
}
let arr_size: usize = (n + 1) as usize
or you can convert and panic (throw error) if the converted value doesn't fit with .try_into().unwrap()
let arr_size: usize = (n + 1).try_into().unwrap();
try_into() attempts to convert one type into another. For example, converting an i32 into a u8.
unwrap() extracts the value inside the Result if it is Ok. If the Result is Err, unwrap() will cause the program to panic and terminate, printing an error message.
https://doc.rust-lang.org/rust-by-example/types/cast.html
https://chatgpt.com/share/678fb2e1-20e8-800a-82d7-53d3756ca318