diff --git a/turtle-lib/src/builders.rs b/turtle-lib/src/builders.rs index bdcf84e..ba87891 100644 --- a/turtle-lib/src/builders.rs +++ b/turtle-lib/src/builders.rs @@ -222,7 +222,7 @@ pub trait CurvedMovement: WithCommands { } /// Builder for creating turtle command sequences -#[derive(Default, Debug)] +#[derive(Clone, Default, Debug)] pub struct TurtlePlan { queue: CommandQueue, } diff --git a/turtle-lib/src/commands_channel.rs b/turtle-lib/src/commands_channel.rs index 7a70fa2..ac02e73 100644 --- a/turtle-lib/src/commands_channel.rs +++ b/turtle-lib/src/commands_channel.rs @@ -8,7 +8,7 @@ //! ```no_run //! use turtle_lib::*; //! use std::thread; -//! +//! use macroquad::prelude::{next_frame, clear_background, WHITE}; //! # #[macroquad::main("Threading")] //! # async fn main() { //! let mut app = TurtleApp::new(); @@ -59,7 +59,7 @@ use crossbeam::channel::{bounded, Receiver, Sender}; /// // Send commands from game thread /// let mut plan = create_turtle_plan(); /// plan.forward(50.0); -/// tx.send(plan.build())?; +/// tx.send(plan.clone().build())?; /// /// // Or non-blocking variant /// tx.try_send(plan.build()).ok(); diff --git a/turtle-lib/src/lib.rs b/turtle-lib/src/lib.rs index 0163175..ccde09e 100644 --- a/turtle-lib/src/lib.rs +++ b/turtle-lib/src/lib.rs @@ -32,7 +32,7 @@ //! //! #[macroquad::main("Turtle")] //! async fn main() { -//! let mut plan = create_turtle(); +//! let mut plan = create_turtle_plan(); //! plan.forward(100.0).right(90.0).forward(100.0); //! //! let mut app = TurtleApp::new().with_commands(plan.build()); @@ -154,6 +154,7 @@ impl TurtleApp { /// # Examples /// ```no_run /// # use turtle_lib::*; + /// # use macroquad::prelude::{next_frame, clear_background, WHITE}; /// # #[macroquad::main("Threading")] /// # async fn main() { /// # let mut app = TurtleApp::new(); @@ -359,7 +360,7 @@ impl Default for TurtleApp { /// ``` /// use turtle_lib::*; /// -/// let mut turtle = create_turtle(); +/// let mut turtle = create_turtle_plan(); /// turtle.forward(100.0).right(90.0).forward(50.0); /// let commands = turtle.build(); /// ```