As you can see from the below code that I want to derive Serialize for struct Foo. But since member k is of array type this code gives me error. How do I solve this?
use serde::{Deserialize, Serialize};
#[derive(Serialize, Debug)]
struct Bar {}
#[derive(Serialize, Debug)]
struct Foo {
k: [Bar; 100],
}
error :
error[E0277]: the trait bound `[Bar; 100]: Serialize` is not satisfied
--> src/main.rs:57:5
|
57 | k: [Bar; 100],
| ^ the trait `Serialize` is not implemented for `[Bar; 100]`
|
= help: the following implementations were found:
<[T; 0] as Serialize>
<[T; 10] as Serialize>
<[T; 11] as Serialize>
<[T; 12] as Serialize>
and 30 others
Is this really a case of low MSRV? I thought that serde and rand don't support generic arrays because they special-cased 0-sized arrays, and thus can't support const generics without either specialization or breaking backwards compatibility.