Make bitflags smaller

pull/505/head
Cédric Barreteau 3 years ago
parent fbd834469f
commit fe5f672986

@ -39,16 +39,16 @@ bitflags! {
/// let m = Modifier::BOLD | Modifier::ITALIC;
/// ```
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Modifier: u16 {
const BOLD = 0b0000_0000_0001;
const DIM = 0b0000_0000_0010;
const ITALIC = 0b0000_0000_0100;
const UNDERLINED = 0b0000_0000_1000;
const SLOW_BLINK = 0b0000_0001_0000;
const RAPID_BLINK = 0b0000_0010_0000;
const REVERSED = 0b0000_0100_0000;
const HIDDEN = 0b0000_1000_0000;
const CROSSED_OUT = 0b0001_0000_0000;
pub struct Modifier: u8 {
const BOLD = 0b0000_0000;
const DIM = 0b0000_0001;
const ITALIC = 0b0000_0010;
const UNDERLINED = 0b0000_0100;
const SLOW_BLINK = 0b0000_1000;
const RAPID_BLINK = 0b0001_0000;
const REVERSED = 0b0010_0000;
const HIDDEN = 0b0100_0000;
const CROSSED_OUT = 0b1000_0000;
}
}

@ -44,17 +44,17 @@ use bitflags::bitflags;
bitflags! {
/// Bitflags that can be composed to set the visible borders essentially on the block widget.
pub struct Borders: u32 {
pub struct Borders: u8 {
/// Show no border (default)
const NONE = 0b0000_0001;
const NONE = 0b0000;
/// Show the top border
const TOP = 0b0000_0010;
const TOP = 0b0001;
/// Show the right border
const RIGHT = 0b0000_0100;
const RIGHT = 0b0010;
/// Show the bottom border
const BOTTOM = 0b000_1000;
const BOTTOM = 0b0100;
/// Show the left border
const LEFT = 0b0001_0000;
const LEFT = 0b1000;
/// Show all borders
const ALL = Self::TOP.bits | Self::RIGHT.bits | Self::BOTTOM.bits | Self::LEFT.bits;
}

Loading…
Cancel
Save