-
I have a set of structs that have I would like to expose these structs to Python, but |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 11 replies
-
You would have to define a "newtype wrapper" struct like
and implement the Another way is to contribute integration to |
Beta Was this translation helpful? Give feedback.
-
I've made a rough swag at adding this into pyo3 proper at https://github.com/cardoe/pyo3/tree/decimal right now there's no docs and the tests aren't great. I'm hoping someone like @davidhewitt can tell me if this approach is okay and I'll work at getting this PR worthy. |
Beta Was this translation helpful? Give feedback.
-
I think this boilerplate is much less than you expect, so I'd still lean towards this over providing the conversions ourselves. IMO we should only do conversions if we can do it in a "good" way, i.e. if there's a C api we can call. decimal has no such C api. |
Beta Was this translation helpful? Give feedback.
-
@NewbiZ you might want to mark this as answered. #3016 has landed which adds support natively to pyo3 for Decimal via rust_decimal. |
Beta Was this translation helpful? Give feedback.
@NewbiZ you might want to mark this as answered. #3016 has landed which adds support natively to pyo3 for Decimal via rust_decimal.