#cbor #serde #no-std #rust

macro no-std serde-indexed

Derivation of Serialize and Deserialize that replaces struct keys with numerical indices

5 releases

0.1.0 Jan 31, 2021
0.0.4 Mar 27, 2020
0.0.3 Mar 27, 2020
0.0.2 Jan 12, 2020
0.0.1 Jan 12, 2020

#76 in #cbor

Download history 48/week @ 2023-11-20 51/week @ 2023-11-27 17/week @ 2023-12-04 64/week @ 2023-12-11 14/week @ 2023-12-18 9/week @ 2023-12-25 22/week @ 2024-01-01 24/week @ 2024-01-08 16/week @ 2024-01-15 7/week @ 2024-01-22 25/week @ 2024-01-29 47/week @ 2024-02-05 47/week @ 2024-02-12 56/week @ 2024-02-19 84/week @ 2024-02-26 64/week @ 2024-03-04

253 downloads per month
Used in 6 crates (3 directly)

Apache-2.0 OR MIT

18KB
298 lines

serde-indexed

crates.io Documentation

Derivation of Serialize and Deserialize that replaces struct keys with numerical indices.

Primary use case is to handle CTAP CBOR messages, in particular support for:

Example

#[derive(Clone, Debug, PartialEq, SerializeIndexed, DeserializeIndexed)]
#[serde_indexed(offset = 1)]
pub struct SomeKeys {
    pub number: i32,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub option: Option<u8>,
    pub bytes: [u8; 7],
}

This was a nice opportunity to learn proc-macros, I roughly followed serde-repr.

To see some generated code, run cargo expand --test basics.

License

serde-indexed is licensed under either of Apache License, Version 2.0 or MIT License 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.

Dependencies

~1.5MB
~34K SLoC