It is quite often that we need to write custom serde::Deserialize implementations just to validate structure's invariants. If possible, we should write some sort of a hook into serde macro system that would take validation function and generate deserialize implementation for a struct.
Also, maybe there is some crate offering this functionality or it can be done with serde.
It is quite often that we need to write custom
serde::Deserialize
implementations just to validate structure's invariants. If possible, we should write some sort of a hook into serde macro system that would take validation function and generate deserialize implementation for a struct.Also, maybe there is some crate offering this functionality or it can be done with serde.