Debian Codegraph @

tests/res/minimal/rust/src/lib.rs

raw
1 #[repr(C)]
2 pub struct Point {
3 pub x: f32,
4 pub y: f32,
5 }
6
7 #[repr(u32)]
8 pub enum Foo {
9 A = 1,
10 B,
11 C
12 }
13
14 #[no_mangle]
15 pub unsafe extern "C" fn example_get_origin() -> Point {
16 Point { x: 0.0, y: 0.0 }
17 }
18
19 #[no_mangle]
20 pub unsafe extern "C" fn example_print_foo(foo: *const Foo) {
21 println!("{}", match *foo {
22 Foo::A => "a",
23 Foo::B => "b",
24 Foo::C => "c",
25 });
26 }