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

Implementation of conversion traits for 3rd party types #497

Open
birkenfeld opened this issue May 29, 2019 · 2 comments
Open

Implementation of conversion traits for 3rd party types #497

birkenfeld opened this issue May 29, 2019 · 2 comments

Comments

@birkenfeld
Copy link
Member

PyO3 kind of has the same problem as serde: if you wanted to use 3rd-party types in your pyfunctions, the conversion traits (Serialize, FromPyObject) would have to be implemented by the lib that defines them, but usually isn't. In your crate using pyo3, you can then only work with newtype wrappers, which is ok but not great. In particular, it makes using the same functions/methods also from Rust annoying.

I don't really know of a workaround. But I would never have suspected about the one with inventory, used for avoiding specialization, so who knows... 😄

@birkenfeld
Copy link
Member Author

serde's solution: https://serde.rs/remote-derive.html

@davidhewitt
Copy link
Member

Interesting alternative which came up in #884 was that perhaps we can add an annotation to method arguments to use a custom converter.

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

No branches or pull requests

2 participants