derive_ostream.rs 821 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /// cbindgen:derive-ostream
  2. #[repr(C)]
  3. pub struct A(i32);
  4. /// cbindgen:field-names=[x, y]
  5. /// cbindgen:derive-ostream
  6. #[repr(C)]
  7. pub struct B(i32, f32);
  8. /// cbindgen:derive-ostream
  9. #[repr(u32)]
  10. pub enum C {
  11. X = 2,
  12. Y,
  13. }
  14. /// cbindgen:derive-ostream
  15. #[repr(C)]
  16. pub struct D {
  17. List: u8,
  18. Of: usize,
  19. Things: B,
  20. }
  21. /// cbindgen:derive-ostream
  22. #[repr(u8)]
  23. pub enum F {
  24. Foo(i16),
  25. Bar { x: u8, y: i16 },
  26. Baz
  27. }
  28. /// cbindgen:derive-ostream
  29. #[repr(C, u8)]
  30. pub enum H {
  31. Hello(i16),
  32. There { x: u8, y: i16 },
  33. Everyone
  34. }
  35. /// cbindgen:derive-ostream=false
  36. #[repr(C, u8)]
  37. pub enum I {
  38. /// cbindgen:derive-ostream=true
  39. ThereAgain { x: u8, y: i16 },
  40. SomethingElse
  41. }
  42. #[no_mangle]
  43. pub extern "C" fn root(
  44. a: A,
  45. b: B,
  46. c: C,
  47. d: D,
  48. f: F,
  49. h: H,
  50. i: I,
  51. ) { }