Any way to make serde serialization of a hash type vary based on format?

I've got a hash type (a wrapper around [u8; 16]) and would like to have a Serialize implementation that serializes e.g. in json as a hex string, but serializes in binary in formats that support it. Is there any solution for this?

You're probably looking for Serializer::is_human_readable.

2 Likes

Awesome, thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.