#[derive(Clone, Debug)]
pub struct Pad(pub u32, pub Symbol);
impl ToCss for Pad
{
fn to_css<W: fmt::Write>(&self, dest: &mut W) -> fmt::Result
{
self.0.to_css(dest)?;
dest.write_char(' ')?;
self.1.to_css(dest)
}
}
impl Parse for Pad
{
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i, CustomParseError<'i>>>
{
let pad_with = input.try(|input| Symbol::parse(context, input));
let min_length = input.expect_integer()?;
if min_length < 0
{
return Err(ParseError::Custom(CustomParseError::CounterStylePadMinLengthCanNotBeNegative(min_length)))
}
let pad_with = pad_with.or_else(|_| Symbol::parse(context, input))?;
Ok(Pad(min_length as u32, pad_with))
}
}