lewp_css/domain/at_rules/media/
color_bit_depth.rs1use {
5 crate::{
6 domain::{
7 expressions::CalculablePropertyValue,
8 numbers::CssUnsignedInteger,
9 units::Unit,
10 },
11 parsers::{Parse, ParserContext},
12 CustomParseError,
13 },
14 cssparser::{ParseError, Parser, ToCss},
15 std::fmt,
16};
17
18#[derive(Default, Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
19pub struct ColorBitDepth(CalculablePropertyValue<CssUnsignedInteger>);
20
21impl ToCss for ColorBitDepth {
22 fn to_css<W: fmt::Write>(&self, dest: &mut W) -> fmt::Result {
23 self.0.to_css(dest)
24 }
25}
26
27impl Parse for ColorBitDepth {
28 fn parse<'i, 't>(
29 context: &ParserContext,
30 input: &mut Parser<'i, 't>,
31 ) -> Result<Self, ParseError<'i, CustomParseError<'i>>> {
32 Ok(ColorBitDepth(
33 CssUnsignedInteger::parse_one_outside_calc_function(
34 context, input,
35 )?,
36 ))
37 }
38}