mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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:
parent
3672856efa
commit
cd8f96cc9e
89 changed files with 873 additions and 533 deletions
|
@ -48,7 +48,7 @@ pub fn derive(input: DeriveInput) -> Tokens {
|
|||
}
|
||||
|
||||
quote! {{
|
||||
let mut writer = ::style_traits::values::SequenceWriter::new(&mut *dest, #separator);
|
||||
let mut writer = ::style_traits::values::SequenceWriter::new(dest, #separator);
|
||||
#expr
|
||||
Ok(())
|
||||
}}
|
||||
|
@ -78,7 +78,10 @@ pub fn derive(input: DeriveInput) -> Tokens {
|
|||
impl #impl_generics ::style_traits::ToCss for #name #ty_generics #where_clause {
|
||||
#[allow(unused_variables)]
|
||||
#[inline]
|
||||
fn to_css<W>(&self, dest: &mut W) -> ::std::fmt::Result
|
||||
fn to_css<W>(
|
||||
&self,
|
||||
dest: &mut ::style_traits::CssWriter<W>,
|
||||
) -> ::std::fmt::Result
|
||||
where
|
||||
W: ::std::fmt::Write
|
||||
{
|
||||
|
@ -93,7 +96,10 @@ pub fn derive(input: DeriveInput) -> Tokens {
|
|||
impls.append(quote! {
|
||||
impl #impl_generics ::std::fmt::Debug for #name #ty_generics #where_clause {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
::style_traits::ToCss::to_css(self, f)
|
||||
::style_traits::ToCss::to_css(
|
||||
self,
|
||||
&mut ::style_traits::CssWriter::new(f),
|
||||
)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue