summaryrefslogtreecommitdiffstats
path: root/svgbob/examples/long.rs
diff options
context:
space:
mode:
Diffstat (limited to 'svgbob/examples/long.rs')
-rw-r--r--svgbob/examples/long.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/svgbob/examples/long.rs b/svgbob/examples/long.rs
index 265bfaf..a2901ac 100644
--- a/svgbob/examples/long.rs
+++ b/svgbob/examples/long.rs
@@ -1,14 +1,12 @@
-extern crate svg;
-extern crate svgbob;
+use std::{fs, io, time::Instant};
-use svgbob::Grid;
-use svgbob::Settings;
+extern crate svgbob;
-fn main() {
- let file = "examples/long.svg";
- let arg = include_str!("long.bob");
- let g = Grid::from_str(arg, &Settings::default());
- let svg = g.get_svg();
- svg::save(file, &svg).unwrap();
- println!("Saved to {}", file);
+fn main() -> io::Result<()> {
+ let art = include_str!("../test_data/long.bob");
+ let t1 = Instant::now();
+ fs::create_dir_all("out")?;
+ fs::write("out/long.svg", svgbob::to_svg(art))?;
+ println!("took {}ms", t1.elapsed().as_millis());
+ Ok(())
}