Big array helper for serde. The purpose of this crate is to make (de-)serializing arrays of sizes > 32 easy. This solution is needed until serde adopts const generics support.
Bases on this snippet.
```Rust extern crate serde;
extern crate serdederive; extern crate serdejson;
extern crate serdebigarray;
big_array! { BigArray; }
struct S { #[serde(with = "BigArray")] arr: [u8; 64], }
fn test() {
let s = S { arr: [1; 64] };
let j = serdejson::tostring(&s).unwrap();
let sback = serdejson::fromstr::(&j).unwrap();
assert!(&s.arr[..] == &sback.arr[..]);
}
```
If you enable the const-generics
feature, you won't have to invoke the big_array
macro any more:
```Rust
extern crate serdederive; use serdebig_array::BigArray;
struct S { #[serde(with = "BigArray")] arr: [u8; 64], }
fn test() {
let s = S { arr: [1; 64] };
let j = serdejson::tostring(&s).unwrap();
let sback = serdejson::fromstr::(&j).unwrap();
assert!(&s.arr[..] == &sback.arr[..]);
}
```
Important links:
The minimum supported Rust version (MSRV) is Rust 1.32.0.
This crate is distributed under the terms of both the MIT license and the Apache License (Version 2.0), at your option.
See LICENSE-APACHE and LICENSE-MIT for details.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.