Skip to content

Add annotation-based custom field attributes support #3198

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ekoops
Copy link

@ekoops ekoops commented Apr 26, 2025

This PR adds support for specifying custom field attributes through annotations.

Given the following input,

struct S {
    /// <div rustbindgen attribute="#[Attr1] #[Attr2]" attribute="#[Attr3(value)]"></div>
    int field_1;
    char field_2;
};

the generated bindings will contain the specified attributes

pub struct S {
    /// <div rustbindgen attribute="#[Attr1] #[Attr2]" attribute="#[Attr3(value)]"></div>
    #[Attr1]
    #[Attr2]
    #[Attr3(value)]
    pub field_1: ::std::os::raw::c_int,
    pub field_2: ::std::os::raw::c_char,
}

@ekoops ekoops force-pushed the ekoops/field-attributes branch 3 times, most recently from 9a91261 to 79437a5 Compare April 26, 2025 16:09
Signed-off-by: Leonardo Di Giovanna <[email protected]>
@ekoops ekoops force-pushed the ekoops/field-attributes branch from 79437a5 to f1860bd Compare April 26, 2025 16:34
@ekoops
Copy link
Author

ekoops commented Apr 26, 2025

r? @emilio

@rustbot
Copy link
Collaborator

rustbot commented Apr 26, 2025

Error: The feature assign is not enabled in this repository.
To enable it add its section in the triagebot.toml in the root of the repository.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

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

Successfully merging this pull request may close these issues.

2 participants