<commit_before>use std::fmt::Debug;
use std::path::Path;

use crate::{Turtle, Color, Point, Size, ExportError};
use crate::async_drawing::AsyncDrawing;
use crate::sync_runtime::block_on;

/// Provides access to properties of the drawing that the turtle is creating
///
/// # Accessing The Drawing
///
/// The most common way to create a new drawing is implicitly through the [`Turtle::new()`] method.
///
/// ```rust,no_run
/// # use turtle::*;
/// let mut turtle = Turtle::new();
/// ```
///
/// That method returns a new [`Turtle`] and allows you to begin drawing right away, but doesn't
/// provide the ability to manipulate the properties of the drawing you are creating.
///
/// To get access to those properties, you need to change the way you create your turtle to match
/// the following:
///
/// ```rust,no_run
/// # use turtle::*;
/// let mut drawing = Drawing::new();
/// let mut turtle = drawing.add_turtle();
///
/// // Now you can set properties on the drawing
/// drawing.set_title("Really cool picture!");
/// // You can also draw things using the turtle you created
/// turtle.forward(100.0);
/// ```
///
/// This creates a new [`Drawing`], and then adds a turtle using the [`add_turtle()`] method.
///
/// [`Turtle`]: struct.Turtle.html
/// [`Turtle::new()`]: struct.Turtle.html#method.new
/// [`Drawing`]: struct.Drawing.html
/// [`add_turtle()`]: struct.Drawing.html#method.add_turtle
pub struct Drawing {
    drawing: AsyncDrawing,
    //TODO: Remove this field when multiple turtles are supported
    turtles: usize,
}

impl From<AsyncDrawing> for Drawing {
    fn from(drawing: AsyncDrawing) -> Self {
        //TODO: There is no way to set `turtles` properly here, but that's okay since it is going
        // to be removed soon.
        Self {drawing, turtles: 1}
    }
}

impl Drawing {
    /// Creates a new drawing
    ///
    /// This will immediately open a new window with a completely blank image.
    ///
    /// To create a new turtle in the image, use the [`add_turtle()`] method.
    ///
    /// [`add_turtle()`]: struct.Drawing.html#method.add_turtle
    pub fn new() -> Drawing {
        // This needs to be called as close to the start of the program as possible. We call it<commit_msg>Documenting that you probably don't want Drawing::new() and Turtle::new()<commit_after>use std::fmt::Debug;
use std::path::Path;

use crate::{Turtle, Color, Point, Size, ExportError};
use crate::async_drawing::AsyncDrawing;
use crate::sync_runtime::block_on;

/// Provides access to properties of the drawing that the turtle is creating
///
/// # Accessing The Drawing
///
/// The most common way to create a new drawing is implicitly through the [`Turtle::new()`] method.
///
/// ```rust,no_run
/// # use turtle::*;
/// let mut turtle = Turtle::new();
/// ```
///
/// That method returns a new [`Turtle`] and allows you to begin drawing right away, but doesn't
/// provide the ability to manipulate the properties of the drawing you are creating.
///
/// To get access to those properties, you need to change the way you create your turtle to match
/// the following:
///
/// ```rust,no_run
/// # use turtle::*;
/// let mut drawing = Drawing::new();
/// let mut turtle = drawing.add_turtle();
///
/// // Now you can set properties on the drawing
/// drawing.set_title("Really cool picture!");
/// // You can also draw things using the turtle you created
/// turtle.forward(100.0);
/// ```
///
/// This creates a new [`Drawing`], and then adds a turtle using the [`add_turtle()`] method.
///
/// It is usually **incorrect** to call both [`Drawing::new()`] and [`Turtle::new()`]. Each of
/// those methods creates a new window. You can only draw on a drawing with turtles created using
/// the [`add_turtle()`] method on that drawing.
///
/// ```rust,no_run
/// # use turtle::*;
/// let mut drawing = Drawing::new();
/// let mut turtle = Turtle::new(); // <-- This is probably **incorrect**
/// ```
///
/// [`Turtle`]: struct.Turtle.html
/// [`Turtle::new()`]: struct.Turtle.html#method.new
/// [`Drawing`]: struct.Drawing.html
/// [`Drawing::new()`]: struct.Drawing.html#method.new
/// [`add_turtle()`]: struct.Drawing.html#method.add_turtle
pub struct Drawing {
    drawing: AsyncDrawing,
    //TODO: Remove this field when multiple turtles are supported
    turtles: usize,
}

impl From<AsyncDrawing> for Drawing {
    fn from(drawing: AsyncDrawing) -> Self {
        //TODO: There is no way to set `turtles` properly here, but that's okay since it is going
        // to be removed soon.
        Self {drawing, turtles: 1}
    }
}

impl Drawing {
    /// Creates a new drawing
    ///
    /// This will immediately open a new window with a completely blank image.
    ///
    /// To create a new turtle in the image, use the [`add_turtle()`] method.
    ///
    /// [`add_turtle()`]: struct.Drawing.html#method.add_turtle
    pub fn new() -> Drawing {
        // This needs to be called as close to the start of the program as possible. We call it
{'fraction_non_alphanumeric': 0.16180904522613065, 'fraction_numerical': 0.0020100502512562816, 'mean_word_length': 2.9523431294678315, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1595014', 'n_tokens_mistral': 1544, 'n_tokens_neox': 1441, 'n_words': 575}