@@ -198,6 +198,14 @@ impl<'a> CSSInliner<'a> {
198198
199199 /// Inline CSS styles from <style> tags to matching elements in the HTML tree and return a
200200 /// string.
201+ ///
202+ /// # Errors
203+ ///
204+ /// Inlining might fail for the following reasons:
205+ /// - Missing stylesheet file;
206+ /// - Remote stylesheet is not available;
207+ /// - IO errors;
208+ /// - Internal CSS selector parsing error;
201209 #[ inline]
202210 pub fn inline ( & self , html : & str ) -> Result < String > {
203211 // Allocating the same amount of memory as the input HTML helps to avoid
@@ -210,6 +218,14 @@ impl<'a> CSSInliner<'a> {
210218
211219 /// Inline CSS & write the result to a generic writer. Use it if you want to write
212220 /// the inlined document to a file.
221+ ///
222+ /// # Errors
223+ ///
224+ /// Inlining might fail for the following reasons:
225+ /// - Missing stylesheet file;
226+ /// - Remote stylesheet is not available;
227+ /// - IO errors;
228+ /// - Internal CSS selector parsing error;
213229 #[ inline]
214230 pub fn inline_to < W : Write > ( & self , html : & str , target : & mut W ) -> Result < ( ) > {
215231 let document = parse_html ( ) . one ( html) ;
@@ -390,12 +406,27 @@ impl Default for CSSInliner<'_> {
390406}
391407
392408/// Shortcut for inlining CSS with default parameters.
409+ ///
410+ /// # Errors
411+ ///
412+ /// Inlining might fail for the following reasons:
413+ /// - Missing stylesheet file;
414+ /// - Remote stylesheet is not available;
415+ /// - IO errors;
416+ /// - Internal CSS selector parsing error;
393417#[ inline]
394418pub fn inline ( html : & str ) -> Result < String > {
395419 CSSInliner :: default ( ) . inline ( html)
396420}
397421
398422/// Shortcut for inlining CSS with default parameters and writing the output to a generic writer.
423+ /// # Errors
424+ ///
425+ /// Inlining might fail for the following reasons:
426+ /// - Missing stylesheet file;
427+ /// - Remote stylesheet is not available;
428+ /// - IO errors;
429+ /// - Internal CSS selector parsing error;
399430#[ inline]
400431pub fn inline_to < W : Write > ( html : & str , target : & mut W ) -> Result < ( ) > {
401432 CSSInliner :: default ( ) . inline_to ( html, target)
@@ -420,7 +451,7 @@ fn merge_styles(
420451 replace_double_quotes ! ( final_styles, name, value) ;
421452 final_styles. push ( ';' ) ;
422453 // This property won't be taken from new styles
423- buffer. push ( name. to_string ( ) )
454+ buffer. push ( name. to_string ( ) ) ;
424455 }
425456 for ( property, ( _, value) ) in new_styles {
426457 if !buffer. contains ( property) {
0 commit comments