-
Notifications
You must be signed in to change notification settings - Fork 382
Closed
Labels
Description
Hey, this may not be the right direction to go, but feel free to correct me.
I am wrapping a C++ library, and they've defined a struct like this:
struct Thing {
unsigned char someenum;
}
I want to be able to directly access the struct with a Rust struct like this:
enum SomeEnum {
A,
B,
C
}
struct Thing {
someenum: SomeEnum,
}
As a test, I've tried doing something like this:
#[cxx::bridge]
mod ffi {
enum SomeEnum {
A,
B,
C,
}
struct Thing {
someenum: SomeEnum,
}
}
unsafe impl cxx::ExternType for ffi::Thing {
type Id = cxx::type_id!("Thing");
}
But I'm probably misunderstanding how ExternType works.
Either way, is this (or something like this) possible to do in cxx currently (or will be possible in the near future)?
Thanks!