-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
We already learned the hard way that the automatic indexing based on the field order can be a footgun. Skipping fields as implemented in #14 makes it even easier to break compatibility with older versions.
As a workaround, we could require explicit indices (or at least provide an alternative macro that works with explicit indices), for example:
#[derive(Clone, Debug, PartialEq, SerializeIndexed, DeserializeIndexed)]
pub struct SomeKeys {
#[serde_indexed(index = 1)]
pub number: i32,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde_indexed(index = 2)]
pub option: Option<u8>,
#[serde_indexed(index = 3)]
pub bytes: [u8; 7],
}
AlfioEmanueleFresta
Metadata
Metadata
Assignees
Labels
No labels