Open nectariner opened 6 months ago
You can use Config::try_deserialize()
to deserialize config to your own type and have that implement Serialize
!
Apologies if this is a stupid question (I'm not familiar with the codebase whatsoever) - is there a reason why it couldn't implement Serialize
itself?
Hm, I don't know to be honest. One thing I could imagine is that serializing does more than just "dumping the data to some format", but actually includes logic that is a bit more on the heavy side of things? Like... it actually has to compute stuff to be even able to provide the data that is needed for the serialization, and because of that implementing Serialize
directly would give a user a false sense of "cost" for this functionality?
But to be honest, I don't really know.
I want to be able to serialize my config to json so that when I log it Cloudwatch formats it correctly. I'm not aware of another simple way of doing this, it's unfortunate since the regular debug output is so close to what I need but Cloudwatch formats it horribly since it's not actual json