Subclassing built in types #375
davetapley
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This currently doesn't work:
If I
to_yaml(Config(id=Id('b')))
I get:and when I
from_yaml
I get back astr
, not anId
:My use case for this is that I want to:
a. Add extra methods on to
Id
b. Support multiple ID types via a union, and have
serde
select the correct one, e.g.:which currently fails with:
I can work around for now, by just using the built in types and then casting after, but it would be great if supported by
serde
.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions