Explorar el Código

Add some backwards-compat in here

Getty Ritter hace 5 años
padre
commit
db72b169ff
Se han modificado 1 ficheros con 6 adiciones y 6 borrados
  1. 6 6
      src/lib.rs

+ 6 - 6
src/lib.rs

@@ -4,7 +4,7 @@ use std::io::Write;
 
 /// An SVG document
 pub struct SVG {
-    stuff: Vec<Box<dyn AsSVG>>,
+    stuff: Vec<Box<AsSVG>>,
     size: (f64, f64),
 }
 
@@ -20,17 +20,17 @@ impl Display for Inches {
 
 fn inches(amt: f64) -> Inches { Inches { amt } }
 
-fn xml_tag(w: &mut Vec<u8>, name: &str, attrs: &[(&str, &dyn Display)]) {
+fn xml_tag(w: &mut Vec<u8>, name: &str, attrs: &[(&str, &Display)]) {
     write!(w, "<{}", name);
-    for (k, v) in attrs {
+    for &(k, v) in attrs {
         write!(w, " {}=\"{}\"", k, v);
     }
     writeln!(w, "/>");
 }
 
-fn xml_open(w: &mut Vec<u8>, name: &str, attrs: &[(&str, &dyn Display)]) {
+fn xml_open(w: &mut Vec<u8>, name: &str, attrs: &[(&str, &Display)]) {
     write!(w, "<{}", name);
-    for (k, v) in attrs {
+    for &(k, v) in attrs {
         write!(w, " {}=\"{}\"", k, v);
     }
     writeln!(w, ">");
@@ -132,7 +132,7 @@ impl AsSVG for Line {
                 let mut path = Vec::new();
                 let (x, y) = self.start;
                 write!(&mut path, "M{} {}", x, y);
-                for (x, y) in self.points.iter() {
+                for &(x, y) in self.points.iter() {
                     write!(&mut path, " L{} {}", x, y);
                 }
                 String::from_utf8(path).unwrap()