Crate turtle [] [src]

The API Documentation below will help you learn about the various things you can do with this library.

If this is your first time using Rust or using this library, read the Guide on to learn how to start.

The Turtle struct documentation contains information about the various things you can do with the Turtle instances you create. The color module and its submodules contain hundreds of constants that you can use as color values. As a convenience, you can use the color name listed with each constant in a string instead of the constant itself. See that module for more information about how to use different colors.

Random Values

See the rand module for information about generating random values which can be used in your programs.

Event Handling

For advanced users, the Event enum documentation provides information about how you can create an event loop. This allows you to draw things in response to certain events like the mouse moving, keys being pressed, and more.

The Turtle struct contains a few convenience methods so you can do some common event-related things without creating the entire event loop. For example, use wait_for_click() to wait for the user to click anywhere on the screen before proceeding.


pub use color::Color;
pub use event::Event;
pub use rand::random_range;



Color types and constants


Event handling (mouse, keyboard, controller, touch screen, etc.)


Utilities for generating random values



A turtle with a pen attached to its tail



Represents the supported movement and rotation speeds



Generates a random value using the thread-local random number generator.

Type Definitions


An angle value without a unit


Any distance value (positive or negative)


A point in 2D space: [x, y]