This function will work for the type i32
, but for the type str
:
fn getValues() -> [str; 2] {
[
"37107287533902102798797998220837590246510135740250",
"46376937677490009712648124896970078050417018260538",
]
}
I get the error:
error[E0277]: the size for values of type `str` cannot be known at compilation time --> src/lib.rs:1:1 | 1 | / fn getValues() -> [str; 2] { 2 | | [ 3 | | "37107287533902102798797998220837590246510135740250", 4 | | "46376937677490009712648124896970078050417018260538", 5 | | ] 6 | | } | |_^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> = note: slice and array elements must have `Sized` type
This error makes me think I need to add the size but I did: a size of 2. What is Rust wanting?