summaryrefslogtreecommitdiffstats
path: root/tests/rust/derive_ostream.rs
blob: e7e33fa2c98c93c68bb4a571479a2463582cbabd (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/// cbindgen:derive-ostream
#[repr(C)]
pub struct A(i32);

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

/// cbindgen:derive-ostream
#[repr(u32)]
pub enum C {
    X = 2,
    Y,
}

/// cbindgen:derive-ostream
#[repr(C)]
pub struct D {
    List: u8,
    Of: usize,
    Things: B,
}

/// cbindgen:derive-ostream
#[repr(u8)]
pub enum F {
    Foo(i16),
    Bar { x: u8, y: i16 },
    Baz
}

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

/// cbindgen:derive-ostream=false
#[repr(C, u8)]
pub enum I {
    /// cbindgen:derive-ostream=true
    ThereAgain { x: u8, y: i16 },
    SomethingElse
}

#[no_mangle]
pub extern "C" fn root(
    a: A,
    b: B,
    c: C,
    d: D,
    f: F,
    h: H,
    i: I,
) { }