serde-big-array-options

Crates.ioserde-big-array-options
lib.rsserde-big-array-options
version0.1.1
sourcesrc
created_at2023-10-22 10:52:15.51652
updated_at2023-10-22 20:31:34.582191
descriptionAllow to serialize/deserialize [Option;N]
homepage
repositoryhttps://github.com/nbittich/serde-big-array-options
max_upload_size
id1010508
size3,231
Nordine Bittich (nbittich)

documentation

README

serde-big-array-options

Simpler alternative to serde_with. If you need something more than [Option<T>;N], use that instead.

Usage

const DECK_SIZE:usize = 52;

#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
pub struct Game {
    #[serde(
        serialize_with = "serde_big_array_options::serialize",
        deserialize_with = "serde_big_array_options::deserialize"
    )]
    pub back_in_deck: [Option<usize>; DECK_SIZE],
}

Commit count: 3

cargo fmt