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