summaryrefslogtreecommitdiffstats
path: root/tests/rust/struct.rs
blob: 7569901a482ed8ac6e5156295fb686e53ea02a1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use std::marker::PhantomData;

struct Opaque {
    x: i32,
    y: f32,
}

#[repr(C)]
struct Normal {
    x: i32,
    y: f32,
}

#[repr(C)]
struct NormalWithZST {
    x: i32,
    y: f32,
    z: (),
    w: PhantomData<i32>,
    v: PhantomPinned,
}

/// cbindgen:rename-all=GeckoCase
#[repr(C)]
struct TupleRenamed(i32, f32);

/// cbindgen:field-names=[x, y]
#[repr(C)]
struct TupleNamed(i32, f32);

#[no_mangle]
pub extern "C" fn root(
    a: *mut Opaque,
    b: Normal,
    c: NormalWithZST,
    d: TupleRenamed,
    e: TupleNamed
) { }