#serialization #deserialize #option-t #serialize-deserialize #serde

serde-big-array-options

Allow to serialize/deserialize [Option<T>;N]

2 releases

0.1.1 Oct 22, 2023
0.1.0 Oct 22, 2023

#840 in Encoding

46 downloads per month

MIT license

4KB

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],
}

Dependencies

~110–355KB