Files
cbindgen/tests/rust/assoc_constant.rs
T
IGI-111 110c3e481c Add support for associated constants and struct literals (#170)
* handle associated constants and struct literals

This aims to fix #100 by adding parsing support for associated constants, and
struct literal expressions.

It duplicates some of the parsing for constants, but sadly ImplItemConst and
ImplConst (as well as their children) don't share a common trait
that would allow for genericity.

It also uses the same namespace for both constants and associated
constants, which could cause conflicts in valid Rust with shared const names in
different scopes.

The struct literals use the standard C99 syntax. Do mind that the
limitations on literal expressions still apply.

* added test cases

* fix formatting
2018-10-01 16:37:51 -05:00

12 lines
182 B
Rust

#[repr(C)]
struct Foo {}
impl Foo {
const GA: i32 = 10;
const BU: &'static str = "hello world";
const ZO: f32 = 3.14;
}
#[no_mangle]
pub extern "C" fn root(x: Foo) { }