You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rust enum types are tagged unions. They don't have a fixed representation, eg the compiler optimises Option<&T> to elide the tag entirely, and reduces it to a single pointer where a NULL pointer represents the None variant.
The general case for generating bindings for arbitrary Rust enums is relatively involved. Several new structs need to be emitted + have binding metadata generated for them:
A non-anonymous struct for each enum variant that holds data
A C style union of each of those non-anonymous structs
One final struct which contains an appropriately sized discriminator + an instance of the C style union.
Normal binding metadata should be generated for each of the new explicitly named data variant structs, which can be easily accomplished by attaching the #[dotnet_bindgen] attribute to them.
The metadata emitted for the enumeration should include a mapping from discriminator value to variant.
TODO: The C# that should be generated for the above example.
The text was updated successfully, but these errors were encountered:
Rust enum types are tagged unions. They don't have a fixed representation, eg the compiler optimises Option<&T> to elide the tag entirely, and reduces it to a single pointer where a NULL pointer represents the None variant.
The general case for generating bindings for arbitrary Rust enums is relatively involved. Several new structs need to be emitted + have binding metadata generated for them:
Example:
generates the following structs
Normal binding metadata should be generated for each of the new explicitly named data variant structs, which can be easily accomplished by attaching the
#[dotnet_bindgen]
attribute to them.The metadata emitted for the enumeration should include a mapping from discriminator value to variant.
TODO: The C# that should be generated for the above example.
The text was updated successfully, but these errors were encountered: