Open
Description
I think there should be some support for working with vectors of pointers to structs. Specifically I think the following features would be helpful:
- Having a way to pass from pointers to a struct/enum to pointers to a member. Today this can be done by casting to
const* u8
, adding theoffset_of!
and casting back, but I think a dedicated macro for this would be cleaner. Also theenum
part needs a nightly feature to work (offset_of_enum
) - Having a way to "match" a vector of enums, i.e., given a variant getting a mask encoding which lanes point to instances of this variant. Today there is no general way of doing it (you can try doing the same trick to get the discriminant, but there's no way to know what is the relevant discriminant value for each variant, and it becomes even trickier if the discriminant is optimized in some way (e.g. the niche optimization))