Memory-layout-compatible enum/struct subsets

For the enum case, this could be covered by refined types / pattern types:

With your example, EncodingError would be pattern_type!(Error is Error::A(_) | Error::E).

2 Likes