turtle-graphics 0.1.2

Turtle Graphics for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::fs::File;
use turtle_graphics::{Canvas, Turtle};

fn main() {
    let mut t = Canvas::new();
    t.forward(100.0);
    t.right(90.0);
    t.forward(100.0);
    t.pen_up();
    t.forward(10.0);
    t.pen_down();
    t.right(90.0);
    t.forward(100.0);
    t.right(90.0);
    t.forward(100.0);
    t.save_svg(&mut File::create("test.svg").unwrap()).unwrap();
    t.save_eps(&mut File::create("test.eps").unwrap()).unwrap();
}