mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-24 10:03:39 +00:00

This adds support for passing C-style enums between Rust and C++. We use the Rust representation for enums suggested by dtolnay in #132. Note that as this does not use real enums, Rust code cannot treat them as normal enums, e.g., by converting them to integers. But common uses such as pattern matching remain unchanged.
9 lines
80 B
Rust
9 lines
80 B
Rust
#[cxx::bridge]
|
|
mod ffi {
|
|
enum A {
|
|
Field(u64),
|
|
}
|
|
}
|
|
|
|
fn main() {}
|