Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotation to inline type definitions of a field #1004

Open
chyyran opened this issue Sep 30, 2024 · 0 comments
Open

Annotation to inline type definitions of a field #1004

chyyran opened this issue Sep 30, 2024 · 0 comments

Comments

@chyyran
Copy link

chyyran commented Sep 30, 2024

I have the following Rust definition of a struct

#[repr(C)]
pub struct tagged_union_t {
    pub tag: UNION_TYPE,
    pub value: tagged_union_value_t,
}

#[repr(C)]
pub union tagged_union_value_t{
    pub value_1: i32
    pub value_2: i64
}

I'd like an annotation like ///cbindgen:inline-type so the output C header looks like this

typedef struct tagged_union_t {
  UNION_TYPE tag;
  union { int32_t value_1; int64_t value_2; } value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant