Skip to content

Support renaming fields/types/functions to use Rust naming conventions #1098

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
fitzgen opened this issue Oct 24, 2017 · 3 comments
Open

Comments

@fitzgen
Copy link
Member

fitzgen commented Oct 24, 2017

Turn this C struct

struct foo_bar {
    int bazBolly;
};

into

#[repr(C)]
struct FooBar {
    baz_bolly: std::os::raw::c_int,
}

We could use the heck crate.

The hard part will be dealing with name clashes correctly.

@crumblingstatue
Copy link

If #1097 is not feasible, it would also be nice to rustify enum variant names.

@pepyakin
Copy link
Contributor

I think we already have a general problem with a name clashing.

First thing that comes in mind is:

echo 'struct foo { int pub; int pub_; };' | bindgen --no-layout-tests - -- -E
/* automatically generated by rust-bindgen */

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct foo {
    pub pub_: ::std::os::raw::c_int,
    pub pub_: ::std::os::raw::c_int,
}

@fitzgen
Copy link
Member Author

fitzgen commented Oct 25, 2017

I think we already have a general problem with a name clashing.

Yeah, it will only get more likely with renaming fields, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants