>>107017329
There is no concession.
>>107017342
struct Ints {
size_t count;
size_t capacity;
int* pointer;
};
enum SomeEnumTag {
SOME_ENUM_FOO = 0,
SOME_ENUM_BAR = 1,
SOME_ENUM_BAZ = 2,
};
// Rust owned Strings are just dynamic arrays that
// contain utf8 bytes. This is how you would do that in C.
struct String {
size_t length;
size_t capacity;
char* pointer;
};
struct SomeEnum {
SomeEnumTag tag;
union {
struct {
Ints ints;
} bar;
struct {
Ints some_vec;
size_t some_index;
String some_message;
} baz;
} as;
};
In C++ I just use my own Variant<Ts...> type that adds a little bit of syntactic sugar.