[Pre-RFC]: Unnamed struct types

Unnamed structs would also be pretty great for deserializing one-off structures with serde. Sometimes when deserializing a JSON response, you will want to ensure that the response fits a certain structure, but will only care about field names (rather than struct names), for example when you are just extracting a couple Strings from a deeply nested object.

This would be nice for serializing as well, but (for JSON at least) the newish json macro in serde_json already provides a nice interface for the producer side of things (albeit with presumably some overhead).

4 Likes