# serde_keyed_derive This is a fork of [serde_derive](https://github.com/serde-rs/serde) that mirrors the same API but adds an extra attribute called `key`. This allows you to key your structs with literals other than strings. ## Usage ```rs // Do things as normal #[derive(Serialize, Deserialize)] struct Message { #[serde(key = 1)] a: String, #[serde(key = 2)] b: String, #[serde(key = 3)] c: String, #[serde(key = 4)] d: String, } ``` ## For Serde developers As long as your serializer can handle heterogenous maps, your implementation is already supported. Internally, when keys are detected, the generated code serializes structs as maps. ## Limitations This is experimental, so although it's useable for production, breaking changes may happen. See https://github.com/serde-rs/serde/pull/2698