Crates.io | serde_arrays |
lib.rs | serde_arrays |
version | 0.1.0 |
source | src |
created_at | 2021-05-07 00:18:01.098427 |
updated_at | 2021-05-07 00:18:01.098427 |
description | A simple module to support serializing and deserializing const generic or arbitrarily-large arrays. |
homepage | |
repository | https://github.com/Kromey/serde_arrays |
max_upload_size | |
id | 394048 |
size | 25,978 |
A simple module to support serializing and deserializing const generic or arbitrarily-large arrays.
use serde::{Serialize, Deserialize};
use serde_json;
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
struct GenericArray<const N: usize> {
#[serde(with = "serde_arrays")]
arr: [u32; N],
}
let data = GenericArray{ arr: [1; 16] };
let json = serde_json::to_string(&data)?;
let de_data = serde_json::from_str(&json)?;
assert_eq!(data, de_data);
# Ok::<(), serde_json::Error>(())
The minimum supported Rust version (MSRV) for serde_arrays
is 1.51.0.
Licensed under either of
at your option.
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.