Skip to content

Need a way to specify codegen behavior for enum items #392

@upsuper

Description

@upsuper

In nsCSSPropertyID enum, we have something like:

enum nsCSSPropertyID {
  eCSSProperty_a,
  eCSSProperty_b,
  // ...

  eCSSProperty_COUNT,
  eCSSProperty_COUNT_DUMMY2 = eCSSProperty_COUNT - 1,

  eCSSPropertyAlias_aa,
  eCSSPropertyAlias_bb,
  // ...
}

In this case, since eCSSPropertyAlias_aa would be identical to eCSSProperty_COUNT, it would become a separate constant rather than an enum item. This is undesired. Ideally, eCSSProperty_COUNT should become a constant, while eCSSPropertyAlias_aa should be an enum item.

I guess we can add something like

/// <div rustbindgen constant></div>

to bindgen to correct this kind of cases.

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