test cases/rust/44 cbindgen/lib.rs
raw| 1 | /* |
| 2 | * SPDX-License-Identifier: Apache-2.0 |
| 3 | * Copyright © 2024 Intel Corporation |
| 4 | */ |
| 5 | |
| 6 | #[repr(C)] |
| 7 | pub struct MyStruct { |
| 8 | pub cost: i64, |
| 9 | pub power: u8, |
| 10 | } |
| 11 | |
| 12 | #[no_mangle] |
| 13 | pub extern "C" fn print(x: &MyStruct) { |
| 14 | println!("A thing has a cost of {} and a power of {}", x.cost, x.power); |
| 15 | } |