diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-01-22 19:58:01 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-01-23 10:41:42 +0100 |
commit | cd8f96cc9edd5debbb738ffa3124e3d46c5d8bcf (patch) | |
tree | 5c6f46a882b529a5de7b792d44b0ee432ee327bd /components/style/servo/url.rs | |
parent | 3672856efa31195aaa89b007f790df925474001a (diff) | |
download | servo-cd8f96cc9edd5debbb738ffa3124e3d46c5d8bcf.tar.gz servo-cd8f96cc9edd5debbb738ffa3124e3d46c5d8bcf.zip |
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.
Diffstat (limited to 'components/style/servo/url.rs')
-rw-r--r-- | components/style/servo/url.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/components/style/servo/url.rs b/components/style/servo/url.rs index 6dc1d46d2aa..25a4aa5297d 100644 --- a/components/style/servo/url.rs +++ b/components/style/servo/url.rs @@ -6,12 +6,12 @@ use parser::ParserContext; use servo_url::ServoUrl; -use std::fmt; +use std::fmt::{self, Write}; // Note: We use std::sync::Arc rather than servo_arc::Arc here because the // nonzero optimization is important in keeping the size of SpecifiedUrl below // the threshold. use std::sync::Arc; -use style_traits::{ToCss, ParseError}; +use style_traits::{CssWriter, ParseError, ToCss}; use values::computed::{Context, ToComputedValue, ComputedUrl}; /// A specified url() value for servo. @@ -111,7 +111,10 @@ impl PartialEq for SpecifiedUrl { } impl ToCss for SpecifiedUrl { - fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result + where + W: Write, + { let string = match self.original { Some(ref original) => &**original, None => match self.resolved { |