Rust enums are not allowed to contain unspecified values (although, I guess with the repr attribute most of the optimizations that would break it are disabled). I think you should use a transparent newtype for these sorts of scenarios, it gives you much more direct control while being almost as ergonomic:
#[repr(transparent)]
#[derive(Copy, Clone, Debug, ...)]
pub struct Data(u8);
impl Data {
const VARIANT1: Data = Data(0);
const VARIANT2: Data = Data(1);
...
fn is_valid(&self) -> bool {
match *self {
Data::VARIANT1 | Data::VARIANT2 | ... => true,
_ => false,
}
}
}