How to mix serde with =
and serde_as
rules? / u128 as Hex
#507
-
I would like to chain something like serde
Can I achieve something like this? Also, could there be a simple way to (de)serialize a number (in this case, an |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I am unsure what exactly you think the In your case, your module will need to do everything, i.e., turn the |
Beta Was this translation helpful? Give feedback.
I am unsure what exactly you think the
u128_as_buffer
should be doing. But I am not aware of any way of chaining multiple functions. Theserde_as
macro will also not let you useas
andwith
on the same field.In your case, your module will need to do everything, i.e., turn the
u128
into a hex value and then instruct theSerializer
how to serialize it. Of course it is also possible to use theSerializeAs
trait from this crate, i.e., you can make a type similar toHex
which supportsu128
.