#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct MediaGrid
{
pub is_grid: bool,
}
impl ToCss for MediaGrid
{
fn to_css<W: fmt::Write>(&self, dest: &mut W) -> fmt::Result
{
let value = if self.is_grid
{
1
}
else
{
0
};
value.to_css(dest)
}
}
impl Parse for MediaGrid
{
fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i, CustomParseError<'i>>>
{
let is_grid = match input.expect_integer()?
{
0 => false,
1 => true,
invalid @ _ => return Err(ParseError::Custom(CustomParseError::MediaGridMustBeEitherZeroOrOne(invalid))),
};
Ok
(
Self
{
is_grid
}
)
}
}