We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#1743 has one implementation of sorting, to get the resulting Rust code in a certain order. However, it can be better.
class Foo { public: int foo; int get_foo(); }; class Bar { public: int bar; int get_bar(); };
$ bindgen input.h --no-layout-tests --sort-semantically
/* automatically generated by rust-bindgen 0.60.1 */ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Foo { pub foo: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Bar { pub bar: ::std::os::raw::c_int, } impl Foo { #[inline] pub unsafe fn get_foo(&mut self) -> ::std::os::raw::c_int { Foo_get_foo(self) } } impl Bar { #[inline] pub unsafe fn get_bar(&mut self) -> ::std::os::raw::c_int { Bar_get_bar(self) } } extern "C" { #[link_name = "\u{1}_ZN3Foo7get_fooEv"] pub fn Foo_get_foo(this: *mut Foo) -> ::std::os::raw::c_int; } extern "C" { #[link_name = "\u{1}_ZN3Bar7get_barEv"] pub fn Bar_get_bar(this: *mut Bar) -> ::std::os::raw::c_int; }
and/or
Insert compilation errors generated when compiling the bindings with rustc here
The order is actually, type followed by the type's impls and extern fns
impl
extern fn
/* automatically generated by rust-bindgen 0.60.1 */ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Foo { pub foo: ::std::os::raw::c_int, } impl Foo { #[inline] pub unsafe fn get_foo(&mut self) -> ::std::os::raw::c_int { Foo_get_foo(self) } } extern "C" { #[link_name = "\u{1}_ZN3Foo7get_fooEv"] pub fn Foo_get_foo(this: *mut Foo) -> ::std::os::raw::c_int; } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Bar { pub bar: ::std::os::raw::c_int, } impl Bar { #[inline] pub unsafe fn get_bar(&mut self) -> ::std::os::raw::c_int { Bar_get_bar(self) } } extern "C" { #[link_name = "\u{1}_ZN3Bar7get_barEv"] pub fn Bar_get_bar(this: *mut Bar) -> ::std::os::raw::c_int; }
The text was updated successfully, but these errors were encountered:
closing this because there is a decent implicit sorting of the elements already.
Sorry, something went wrong.
amanjeev
No branches or pull requests
#1743 has one implementation of sorting, to get the resulting Rust code in a certain order. However, it can be better.
Input C/C++ Header
Bindgen Invocation
Actual Results
and/or
Expected or rather Better Results
The order is actually, type followed by the type's
impl
s andextern fn
sThe text was updated successfully, but these errors were encountered: