File: impl_unsafe_attr_method.rs

package info (click to toggle)
rust-cbindgen 0.29.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,248 kB
  • sloc: ansic: 15; makefile: 11
file content (21 lines) | stat: -rw-r--r-- 375 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#[repr(C)]
pub struct DummyStruct {
    dummy_field: i32,
}


impl DummyStruct {
    #[unsafe(export_name = "new_dummy")]
    pub const extern "C" fn new() -> Self {
        Self {
            dummy_field: 0,
        }
    }

    #[unsafe(no_mangle)]
    pub extern "C" fn new_dummy_param(dummy_field: i32) -> Self {
        Self {
            dummy_field,
        }
    }
}