pub trait Turtle {
Show 14 methods
// Required methods
fn forward<T: Into<Distance>>(&mut self, distance: T);
fn move_forward<T: Into<Distance>>(&mut self, distance: T);
fn rotate<T: Into<Degree>>(&mut self, angle: T);
fn is_pen_down(&self) -> bool;
fn pen_down(&mut self);
fn pen_up(&mut self);
fn goto(&mut self, pos: Position);
fn push(&mut self);
fn pop(&mut self);
// Provided methods
fn backward<T: Into<Distance>>(&mut self, distance: T) { ... }
fn right<T: Into<Degree>>(&mut self, angle: T) { ... }
fn left<T: Into<Degree>>(&mut self, angle: T) { ... }
fn is_pen_up(&self) -> bool { ... }
fn home(&mut self) { ... }
}Required Methods§
Sourcefn forward<T: Into<Distance>>(&mut self, distance: T)
fn forward<T: Into<Distance>>(&mut self, distance: T)
Move turtle forward by specified distance.
Sourcefn move_forward<T: Into<Distance>>(&mut self, distance: T)
fn move_forward<T: Into<Distance>>(&mut self, distance: T)
Move turtle forward by specified distance without drawing.
Sourcefn rotate<T: Into<Degree>>(&mut self, angle: T)
fn rotate<T: Into<Degree>>(&mut self, angle: T)
Rotate around angle. If angle is positive,
the turtle is turned to the left, if negative,
to the right.
Sourcefn is_pen_down(&self) -> bool
fn is_pen_down(&self) -> bool
Returns true if pen is down.
fn goto(&mut self, pos: Position)
Provided Methods§
Sourcefn backward<T: Into<Distance>>(&mut self, distance: T)
fn backward<T: Into<Distance>>(&mut self, distance: T)
Move turtle backward by specified distance.
Sourcefn right<T: Into<Degree>>(&mut self, angle: T)
fn right<T: Into<Degree>>(&mut self, angle: T)
Turn turtle right by angle degree.
Examples found in repository?
examples/ex1.rs (line 7)
4fn main() {
5 let mut t = Canvas::new();
6 t.forward(100.0);
7 t.right(90.0);
8 t.forward(100.0);
9 t.pen_up();
10 t.forward(10.0);
11 t.pen_down();
12 t.right(90.0);
13 t.forward(100.0);
14 t.right(90.0);
15 t.forward(100.0);
16 t.save_svg(&mut File::create("test.svg").unwrap()).unwrap();
17 t.save_eps(&mut File::create("test.eps").unwrap()).unwrap();
18}fn home(&mut self)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.