Skip to main content

gen_pyo3_data_enum

Function gen_pyo3_data_enum 

Source
pub fn gen_pyo3_data_enum(enum_def: &EnumDef, core_import: &str) -> String
Expand description

Generate a PyO3 data enum as a #[pyclass] struct wrapping the core type.

Data enums (tagged unions like AuthConfig) can’t be flat int enums in PyO3. Instead, generate a frozen struct with inner that accepts a Python dict, serializes it to JSON, and deserializes into the core Rust type via serde.