serde_arrays

Crates.ioserde_arrays
lib.rsserde_arrays
version0.2.0
created_at2021-05-07 00:18:01.098427+00
updated_at2025-03-21 17:55:40.065356+00
descriptionA simple module to support serializing and deserializing const generic or arbitrarily-large arrays.
homepage
repositoryhttps://github.com/Kromey/serde_arrays
max_upload_size
id394048
size38,062
Travis Veazey (Kromey)

documentation

README

serde_arrays

Docs Crates.io CI

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>(())

MSRV

The minimum supported Rust version (MSRV) for serde_arrays is 1.51.0.

License

Licensed under either of

at your option.

Contribution

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.

Commit count: 60

cargo fmt