serde

Serde Deserialize This or That into u64

Bradley Noyes published on
4 min, 771 words

Recently I ran into a bug in my code; hey, it happens. The bug was that I had a struct which could serialize into json, but could not deserialize from its own json. The struct holds a value for a mac address, which is 48-bit integer (that i store in a u64), but it is serialized using the network interface name. For example on my mac, i have a network interface named en1 with the mac address of 20:c9:d0:b0:a4:71:

Read More

A Short Serde Deserialize example

A Short Serde Deserialize example

Bradley Noyes published on
3 min, 509 words

In my previous post, I described taking a simple enum and creating a custom type in diesel. This post will take that same enum and implement deserialize.

I often get tripped up by the mechanics of deserializing so this simple enum makes for a good example. Again, this is to benefit anyone looking for more examples of Serde's Deserialize as well as for myself, so I can remember next time I need to do this.

Read More