diff options
Diffstat (limited to 'svgbob/examples/circuits.rs')
-rw-r--r-- | svgbob/examples/circuits.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/svgbob/examples/circuits.rs b/svgbob/examples/circuits.rs index 6b2ee78..c94fe60 100644 --- a/svgbob/examples/circuits.rs +++ b/svgbob/examples/circuits.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/circuits.svg"; - let arg = include_str!("circuits.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/circuits.bob"); + let t1 = Instant::now(); + fs::create_dir_all("out")?; + fs::write("out/circuits.svg", svgbob::to_svg(art))?; + println!("took {}ms", t1.elapsed().as_millis()); + Ok(()) } |