pub fn gen_pyo3_data_enum(enum_def: &EnumDef, core_import: &str) -> StringExpand 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.
When any variant field is sanitized (its type could not be resolved — e.g. contains
dyn Stream + Send which is not Serialize/Deserialize/Default), the serde-
based #[new] constructor is omitted. The type is still useful as a return value
from Rust (passed back via From impls). The forwarding impls for Default, Serialize,
and Deserialize are always generated regardless of sanitized fields, because the
wrapper struct always delegates to the core type which implements those traits.