mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2025-03-07 07:47:37 +00:00

This both checks for enum values that are illegal due to overflow and ensures we do not overflow on valid enums.
18 lines
220 B
Rust
18 lines
220 B
Rust
#[cxx::bridge]
|
|
mod ffi {
|
|
enum Good1 {
|
|
A = 0xffffffff,
|
|
}
|
|
enum Good2 {
|
|
B = 0xffffffff,
|
|
C = 2020,
|
|
}
|
|
enum Bad {
|
|
D = 0xfffffffe,
|
|
E,
|
|
F,
|
|
}
|
|
}
|
|
|
|
fn main() {}
|