Skip to content

Support complex enum variants #119

Open
@kstreee-furiosa

Description

@kstreee-furiosa

Hi all, I wonder that is there any plans to support complex enum variants.

e.g., if I add variants to enum but sub-gen doesn't catch the variants for now.

#[gen_stub_pyclass_enum]
#[pyclass(eq, eq_int)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Number {
    #[pyo3(name = "FLOAT")]
    Float(f32),
    #[pyo3(name = "INTEGER")]
    Integer(usize),
    Test { a: usize, b: usize },
}

generates

class Number(Enum):
    FLOAT = auto()
    INTEGER = auto()
    Test = auto()

but wants, not sure though, pyo3 may generates additional 'class' for complex enum variants, it probably looks like following..?

class Number(Enum):
    FLOAT = auto()
    INTEGER = "INTEGER"
    Test = "Test"

class INTEGER:
    _0: int

class Test:
    a: int
    b: int

Any plans to support this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions