Change ToCss to take a CssWriter<W>

This more concrete wrapper type can write a prefix the very first time something
is written to it. This allows removing plenty of useless monomorphisations caused
by the former W/SequenceWriter<W> pair of types.
This commit is contained in:
Anthony Ramine 2018-01-22 19:58:01 +01:00
parent 3672856efa
commit cd8f96cc9e
89 changed files with 873 additions and 533 deletions

View file

@ -134,8 +134,8 @@ pub mod traversal_flags;
#[allow(non_camel_case_types)]
pub mod values;
use std::fmt;
use style_traits::ToCss;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
#[cfg(feature = "gecko")] pub use gecko_string_cache as string_cache;
#[cfg(feature = "gecko")] pub use gecko_string_cache::Atom;
@ -181,11 +181,13 @@ longhand_properties_idents!(reexport_computed_values);
/// Serializes as CSS a comma-separated list of any `T` that supports being
/// serialized as CSS.
pub fn serialize_comma_separated_list<W, T>(dest: &mut W,
list: &[T])
-> fmt::Result
where W: fmt::Write,
T: ToCss,
pub fn serialize_comma_separated_list<W, T>(
dest: &mut CssWriter<W>,
list: &[T],
) -> fmt::Result
where
W: Write,
T: ToCss,
{
if list.is_empty() {
return Ok(());