summaryrefslogtreecommitdiffstats
path: root/tests/rust/annotation.rs
blob: 70705923ea131d648a5e85cf49094518ff0742eb (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
39
40
41
42
43
/// cbindgen:derive-lt=true
/// cbindgen:derive-lte=true
/// cbindgen:derive-constructor=true
/// cbindgen:rename-all=GeckoCase
#[repr(C)]
struct A(i32);

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

/// cbindgen:trailing-values=[Z, W]
#[repr(u32)]
enum C {
    X = 2,
    Y,
}

/// cbindgen:derive-helper-methods=true
#[repr(u8)]
enum F {
    Foo(i16),
    Bar { x: u8, y: i16 },
    Baz
}

/// cbindgen:derive-helper-methods
#[repr(C, u8)]
enum H {
    Hello(i16),
    There { x: u8, y: i16 },
    Everyone
}

#[no_mangle]
pub extern "C" fn root(
    x: A,
    y: B,
    z: C,
    f: F,
    h: H,
) { }