toml icon indicating copy to clipboard operation
toml copied to clipboard

support char as map key

Open dhardy opened this issue 1 year ago • 1 comments

When attempting to use an untagged enum over a char as a map key while serializing to TOML I see this error: map key was not a string.

Writing my own serializer which uses char::encode_utf8 lets me work around this, but I think TOML should directly support a char as a map key?

Presumably this is just a little code in KeySerializer's fn serialize_char, maybe also the deserializer.

dhardy avatar Oct 21 '23 08:10 dhardy

The approach I've been taking is that we do whatever serde_json does.

Please follow the pattern in #586 by including a complete reproduction case that contrasts tomls behavior with serde_json.

epage avatar Oct 23 '23 17:10 epage