diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:39:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:39:07 +0000 |
commit | af6b8ed095f88f1df2116cdc7a9d44872cfa6074 (patch) | |
tree | 1f2df671c1f8033d5ed83f056167a0911f8d2a57 /tests/rust/derive_ostream.rs | |
parent | Initial commit. (diff) | |
download | rust-cbindgen-upstream.tar.xz rust-cbindgen-upstream.zip |
Adding upstream version 0.26.0.upstream/0.26.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rust/derive_ostream.rs')
-rw-r--r-- | tests/rust/derive_ostream.rs | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/rust/derive_ostream.rs b/tests/rust/derive_ostream.rs new file mode 100644 index 0000000..e7e33fa --- /dev/null +++ b/tests/rust/derive_ostream.rs @@ -0,0 +1,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, +) { } + |