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.
6 
7 /// A generic type for `column-count` values.
8 #[derive(
9     Animate,
10     Clone,
11     ComputeSquaredDistance,
12     Copy,
13     Debug,
14     MallocSizeOf,
15     Parse,
16     PartialEq,
17     SpecifiedValueInfo,
18     ToAnimatedValue,
19     ToAnimatedZero,
20     ToComputedValue,
21     ToCss,
22     ToResolvedValue,
23     ToShmem,
24 )]
25 pub enum ColumnCount<PositiveInteger> {
26     /// A positive integer.
27     Integer(PositiveInteger),
28     /// The keyword `auto`.
29     #[animation(error)]
30     Auto,
31 }
32 
33 impl<I> ColumnCount<I> {
34     /// Returns `auto`.
35     #[inline]
auto() -> Self36     pub fn auto() -> Self {
37         ColumnCount::Auto
38     }
39 
40     /// Returns whether this value is `auto`.
41     #[inline]
is_auto(self) -> bool42     pub fn is_auto(self) -> bool {
43         matches!(self, ColumnCount::Auto)
44     }
45 }
46