How could I create an array of structs containing big arrays with a fixed size? I want to use arrays and not vectors.
This code is an example but doesn't compile
struct _Tmove {
data1: usize,
data2: u64,
data3: bool,
}
struct _TmoveP {
data4: Box<[_Tmove]>,
data5: isize,
}
fn main() {
let mut gen_list = Box::new([
_TmoveP {
data5: 1,
data4: Box::new([_Tmove { data1: 5, data2: 1, data3: true }; 300]),
}
; 100000]);
assert!(gen_list[0].data4[0].data1==5);
}
error[E0277]: the trait bound `_Tmove: std::marker::Copy` is not satisfied
--> src/main.rs:16:29
|
16 | data4: Box::new([_Tmove { data1: 5, data2: 1, data3: true }; 300]),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the `Copy` trait is required because the repeated element will be copied
error[E0277]: the trait bound `_TmoveP: std::marker::Copy` is not satisfied
--> src/main.rs:13:33
|
13 | let mut gen_list = Box::new([
| ^
|
= note: the `Copy` trait is required because the repeated element will be copied
I am using Rust 1.12.