Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const N: usize = 5;
- struct MyStruct(usize);
- fn main() {
- // Having it un-initialized doesn't work...
- let data: [MyStruct; N];
- // but also can't initialize it as it doesn't implement `Copy`
- // let data: [MyStruct; N] = [MyStruct(0); N];
- for i in 0..N {
- data[i] = MyStruct(i);
- }
- // Do other stuff with `data`...
- }
Add Comment
Please, Sign In to add comment