#[SOLVED] Serde deserialization

4 messages · Page 1 of 1 (latest)

severe yoke
#

I have a custom uuid struct:

pub struct Identifier(Uuid);

It implements TryFrom<Uuid> which does some checks, but serde completely ignores it and thus allows invalid uuid's to be created. How can i make it do those checks (without implementing a custom deserializer)?

molten warren
#

maybe use #[serde(try_from = "Uuid")]?

severe yoke
#

yup that worked 👍 thanks