serde
serde copied to clipboard
Document whether len passed to Serializer::serialize_struct includes skipped fields
The documentation for Serializer::serialize_struct currently says:
lenis the number of data fields that will be serialized.
This implies that the count of skipped field is not to be included in the len. It would be worth calling this out explicitly.
I would even like to get a slice of all the field names of the struct, including the skipped ones. Data formats which can reuse struct layouts would profit from this as using #[serde(skip_serializing_if = "Option::is_none")] or the equivalent #[skip_serializing_none] from serde_with breaks this.
Source: I am currently trying to implement struct layout reusage for my data format and as long as serde isn't telling me about the whole struct layout, I'd have to forbid the aforementioned, really useful features.