constant: Add support for associated constant expressions.

These are useful for bitflags.
This commit is contained in:
Emilio Cobos Álvarez
2022-04-14 16:31:14 +02:00
parent 20ddfffb6a
commit 882af0b563
21 changed files with 171 additions and 24 deletions
+4 -1
View File
@@ -2,7 +2,7 @@ bitflags! {
/// Constants shared by multiple CSS Box Alignment properties
///
/// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
#[derive(MallocSizeOf, ToComputedValue)]
#[derive(MallocSizeOf)]
#[repr(C)]
pub struct AlignFlags: u8 {
/// 'auto'
@@ -13,8 +13,11 @@ bitflags! {
const START = 1 << 1;
/// 'end'
const END = 1 << 2;
const ALIAS = Self::END.bits;
/// 'flex-start'
const FLEX_START = 1 << 3;
const MIXED = 1 << 4 | AlignFlags::FLEX_START.bits | AlignFlags::END.bits;
const MIXED_SELF = 1 << 5 | AlignFlags::FLEX_START.bits | AlignFlags::END.bits;
}
}
+4 -1
View File
@@ -2,7 +2,7 @@ bitflags! {
/// Constants shared by multiple CSS Box Alignment properties
///
/// These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
#[derive(MallocSizeOf, ToComputedValue)]
#[derive(MallocSizeOf)]
#[repr(C)]
pub struct AlignFlags: u8 {
/// 'auto'
@@ -13,8 +13,11 @@ bitflags! {
const START = 1 << 1;
/// 'end'
const END = 1 << 2;
const ALIAS = Self::END.bits;
/// 'flex-start'
const FLEX_START = 1 << 3;
const MIXED = 1 << 4 | AlignFlags::FLEX_START.bits | AlignFlags::END.bits;
const MIXED_SELF = 1 << 5 | AlignFlags::FLEX_START.bits | AlignFlags::END.bits;
}
}