Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example for arbitrary type validation upon deserialization. #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nathan-at-least
Copy link

@nathan-at-least nathan-at-least commented May 8, 2023

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 serde-rs/serde#642 (comment) 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.

@cschramm
Copy link

cschramm commented Aug 1, 2023

I think this is pretty useful, but it might be worth mentioning serde-rs/serde#2178 as a limitation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants