Building Rust FFI bindings by example
To map an enum from Rust to GT, create a subclass of GtExternalEnumeration
and implement the following methods by overriding them in a subclass on the class side: GtExternalEnumeration>>#externalDeclaration
and GtExternalEnumeration>>#externalType
.
A simple enum with an explicit u8 memory representation:
#[repr(u8)]
pub enum Enumeration {
A,
B,
C,
}
maps in GT to GtBoxerExampleU8Enumeration>>#externalDeclaration
with the following GtBoxerExampleU8Enumeration>>#externalType
If an enum has #[repr(u32)] memory representation, return the corresponding externalType
GtBoxerExampleU32Enumeration>>#externalType