Skip to content

Repr-type of rustified translated C enum? #2806

Answered by pvdrz
boozook asked this question in Q&A
Discussion options

You must be logged in to vote

How to determine, preferably before bindings generation, translated rust type of enum?

I think we don't provide any way to do this, maybe we could extend ParseCallbacks to do such thing.

On various archs and OSs it can be unsigned or signed integer (i32/u32/etc) and I need to determine its repr somehow.

The size also depending on args like "short-enum", but I need some default.

In either case bindgen will use the size that clang decides, so if you pass -- -fshort-enums to bindgen, it will behave accordingly.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by boozook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants