Open nathan-at-least opened 1 year ago
This adds an example for a useful pattern where a type needs to be validated arbitrarily (via TryFrom on an inner type) during deserialization. This comes directly from https://github.com/serde-rs/serde/issues/642#issuecomment-683276351 where I learned the pattern.
TryFrom
I couldn't figure out on my own how to do this via browsing https://serde.rs, so I went to the issue tracker where I found this recipe, so it seems like a good candidate for the examples section.
I think this is pretty useful, but it might be worth mentioning https://github.com/serde-rs/serde/issues/2178 as a limitation.
This adds an example for a useful pattern where a type needs to be validated arbitrarily (via
TryFrom
on an inner type) during deserialization. This comes directly from https://github.com/serde-rs/serde/issues/642#issuecomment-683276351 where I learned the pattern.I couldn't figure out on my own how to do this via browsing https://serde.rs, so I went to the issue tracker where I found this recipe, so it seems like a good candidate for the examples section.