rust2go
rust2go copied to clipboard
How to use rust enum type in rust2go
#[derive(rust2go::R2G, Debug)]
#[repr(C)]
enum Enum {
A,
B,
}
#[derive(rust2go::R2G, Debug)]
struct StructTest {
a: Enum,
}
When I use enum type in idl, rust2go-cli will report an error:
$ rust2go-cli --src src/service/cf_bypass.rs --dst go/gen.go [master]
thread 'main' panicked at /Users/leaf-potato/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rust2go-common-0.3.12/src/raw_file.rs:537:26:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I see the existing structures are all lower-level C types, I think you can make an enum by your own.