Skip to main content

style/values/generics/
column.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5//! Generic types for the column properties.
6use crate::derives::*;
7
8/// A generic type for `column-count` values.
9#[derive(
10    Animate,
11    Clone,
12    ComputeSquaredDistance,
13    Copy,
14    Debug,
15    MallocSizeOf,
16    Parse,
17    PartialEq,
18    SpecifiedValueInfo,
19    ToAnimatedValue,
20    ToAnimatedZero,
21    ToComputedValue,
22    ToCss,
23    ToResolvedValue,
24    ToShmem,
25    ToTyped,
26)]
27#[repr(u8)]
28#[typed(todo_derive_fields)]
29pub enum GenericColumnCount<PositiveInteger> {
30    /// A positive integer.
31    Integer(PositiveInteger),
32    /// The keyword `auto`.
33    #[animation(error)]
34    Auto,
35}
36
37pub use self::GenericColumnCount as ColumnCount;
38impl<I> ColumnCount<I> {
39    /// Returns whether this value is `auto`.
40    #[inline]
41    pub fn is_auto(self) -> bool {
42        matches!(self, ColumnCount::Auto)
43    }
44}