style: Have OneOrMoreSeparated replace OneOrMoreCommaSeparated.

A future patch series has some values that should be separated by spaces. This
allows us to re-use the code for serialization, but the types do get a little
clunky. The separator is now indicated with an associated type.
This commit is contained in:
Jonathan Chan 2017-06-19 15:35:58 -07:00
parent e41b7d06b4
commit 26179b3660
6 changed files with 64 additions and 14 deletions

View file

@ -9,7 +9,7 @@ use counter_style::{Symbols, parse_counter_style_name};
use cssparser::Parser;
use parser::{Parse, ParserContext};
use std::fmt;
use style_traits::{OneOrMoreCommaSeparated, ToCss, ParseError, StyleParseError};
use style_traits::{OneOrMoreSeparated, CommaSeparator, ToCss, ParseError, StyleParseError};
use super::CustomIdent;
use values::specified::url::SpecifiedUrl;
@ -123,7 +123,9 @@ pub struct FontSettingTag<T> {
pub value: T,
}
impl<T> OneOrMoreCommaSeparated for FontSettingTag<T> {}
impl<T> OneOrMoreSeparated for FontSettingTag<T> {
type S = CommaSeparator;
}
impl<T: ToCss> ToCss for FontSettingTag<T> {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {