Pyo3: Support exporting Rust enums to Python (old school / without data)

Created on 25 Mar 2020  路  6Comments  路  Source: PyO3/pyo3

Following suggestion this is a subset of #417 to focus just on exporting Rust enums without data to Python. These should be fairly straightforward to support - we could borrow inspiration from C++'s boost.Python and pybind11. We might also want compatibility with the Python enum library.

enhancement

Most helpful comment

I'm nominating this for 0.12.

All 6 comments

I have some messy code that you can use as a reference (originally mentioned in #417): https://salsa.debian.org/Kazan-team/simple-soft-float/-/blob/e19291a0b8eb17e9b52c09b8e670bf0fe3244989/src/python_macros.rs

I'm nominating this for 0.12.

Jake's code looks like a good starting place. Has anyone had a go at it? Happy to test out PRs. I could have a crack at it myself but I think the PR would need a fair bit of hand holding...

I haven't had a go yet, but I plan to have a go soon unless someone else claims this issue sooner!

I made an attempt (#1045), but I got frustrated by the amount of boilerplate and traits required.

As we've got a fair bit to release in 0.12 I'm going to move this to the 0.13 milestone

Was this page helpful?
0 / 5 - 0 ratings