@@ -7,13 +7,13 @@ use ast::*;
77
88
99impl ast:: ComponentValue {
10- pub fn to_css ( & mut self ) -> StrBuf {
11- let mut css = StrBuf :: new ( ) ;
10+ pub fn to_css ( & mut self ) -> String {
11+ let mut css = String :: new ( ) ;
1212 self . to_css_push ( & mut css) ;
1313 css
1414 }
1515
16- pub fn to_css_push ( & self , css : & mut StrBuf ) {
16+ pub fn to_css_push ( & self , css : & mut String ) {
1717 match * self {
1818 Ident ( ref value) => serialize_identifier ( value. as_slice ( ) , css) ,
1919 AtKeyword ( ref value) => {
@@ -58,9 +58,9 @@ impl ast::ComponentValue {
5858 } ,
5959
6060 UnicodeRange ( start, end) => {
61- css. push_str ( format ! ( "U+{:X}" , start) ) ;
61+ css. push_str ( format ! ( "U+{:X}" , start) . as_slice ( ) ) ;
6262 if end != start {
63- css. push_str ( format ! ( "-{:X}" , end) ) ;
63+ css. push_str ( format ! ( "-{:X}" , end) . as_slice ( ) ) ;
6464 }
6565 }
6666
@@ -109,7 +109,7 @@ impl ast::ComponentValue {
109109}
110110
111111
112- pub fn serialize_identifier ( value : & str , css : & mut StrBuf ) {
112+ pub fn serialize_identifier ( value : & str , css : & mut String ) {
113113 // TODO: avoid decoding/re-encoding UTF-8?
114114 let mut iter = value. chars ( ) ;
115115 let mut c = iter. next ( ) . unwrap ( ) ;
@@ -127,9 +127,9 @@ pub fn serialize_identifier(value: &str, css: &mut StrBuf) {
127127
128128
129129#[ inline]
130- fn serialize_char ( c : char , css : & mut StrBuf , is_identifier_start : bool ) {
130+ fn serialize_char ( c : char , css : & mut String , is_identifier_start : bool ) {
131131 match c {
132- '0' ..'9' if is_identifier_start => css. push_str ( format ! ( "\\ \\ 3{} " , c) ) ,
132+ '0' ..'9' if is_identifier_start => css. push_str ( format ! ( "\\ \\ 3{} " , c) . as_slice ( ) ) ,
133133 '-' if is_identifier_start => css. push_str ( "\\ -" ) ,
134134 '0' ..'9' | 'A' ..'Z' | 'a' ..'z' | '_' | '-' => css. push_char ( c) ,
135135 _ if c > '\x7F' => css. push_char ( c) ,
@@ -141,7 +141,7 @@ fn serialize_char(c: char, css: &mut StrBuf, is_identifier_start: bool) {
141141}
142142
143143
144- pub fn serialize_string ( value : & str , css : & mut StrBuf ) {
144+ pub fn serialize_string ( value : & str , css : & mut String ) {
145145 css. push_char ( '"' ) ;
146146 // TODO: avoid decoding/re-encoding UTF-8?
147147 for c in value. chars ( ) {
@@ -159,18 +159,18 @@ pub fn serialize_string(value: &str, css: &mut StrBuf) {
159159
160160
161161pub trait ToCss {
162- fn to_css ( & mut self ) -> StrBuf {
163- let mut css = StrBuf :: new ( ) ;
162+ fn to_css ( & mut self ) -> String {
163+ let mut css = String :: new ( ) ;
164164 self . to_css_push ( & mut css) ;
165165 css
166166 }
167167
168- fn to_css_push ( & mut self , css : & mut StrBuf ) ;
168+ fn to_css_push ( & mut self , css : & mut String ) ;
169169}
170170
171171
172172impl < ' a , I : Iterator < & ' a ComponentValue > > ToCss for I {
173- fn to_css_push ( & mut self , css : & mut StrBuf ) {
173+ fn to_css_push ( & mut self , css : & mut String ) {
174174 let mut previous = match self . next ( ) {
175175 None => return ,
176176 Some ( first) => { first. to_css_push ( css) ; first }
0 commit comments