rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

Add annotation-based custom field attributes support

Open ekoops opened this issue 9 months ago • 3 comments

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 avatar Apr 26 '25 15:04 ekoops

r? @emilio

ekoops avatar Apr 26 '25 16:04 ekoops

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.

rustbot avatar Apr 26 '25 16:04 rustbot

Hey! Is there any chance this patch will get considered any soon?

ekoops avatar May 22 '25 14:05 ekoops