MaikKlein / enumflags

24 stars 7 forks source link

Specifying bits using bitshifting #8

Closed darfink closed 6 years ago

darfink commented 7 years ago

Currently constants cannot be specified using bit shifts. I personally find it much more readable in almost every case.

The following does not compile:

#[repr(u8)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, EnumFlags)]
pub enum CtlCode {
    Banned        = 1 << 0,
    Administrator = 1 << 1,
    Common        = 1 << 2,
}

With the error:

At least one variant was not initialized explicity with a value.
MaikKlein commented 6 years ago

Is now implemented