diff --git a/src/commands.rs b/src/commands.rs index ae5a45d..0c3e630 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -17,7 +17,7 @@ use crate::{ * All the possibilities to draw something with turtle. All the commands can get the position, heading, * color and fill_color from the turtles state. */ -#[derive(Component, Inspectable)] +#[derive(Component, Inspectable, Debug)] pub enum MoveCommand { Forward(Length), Backward(Length), @@ -35,7 +35,7 @@ impl Default for MoveCommand { } /// Different ways to drop breadcrumbs on the way like a dot or a stamp of the turtles shape. -#[derive(Component, Inspectable, Default)] +#[derive(Component, Inspectable, Default, Debug)] pub enum Breadcrumb { Dot, #[default] @@ -43,7 +43,7 @@ pub enum Breadcrumb { } /// Different ways that change the orientation of the turtle. -#[derive(Component, Inspectable)] +#[derive(Component, Inspectable, Debug)] pub enum OrientationCommand { Left(Angle), Right(Angle), @@ -58,7 +58,7 @@ impl Default for OrientationCommand { } /// A combination of all commands that can be used while drawing. -#[derive(Component, Inspectable)] +#[derive(Component, Inspectable, Debug)] pub enum DrawElement { Draw(MoveCommand), Move(MoveCommand), @@ -95,7 +95,7 @@ impl ToAnimationSegment for DrawElement { } } -#[derive(Component, Inspectable)] +#[derive(Component, Inspectable, Debug)] pub enum TurtleSegment { Single(DrawElement), Outline(Vec), @@ -119,7 +119,7 @@ impl ToAnimationSegment for TurtleSegment { } } } -#[derive(Component, Inspectable)] +#[derive(Component, Inspectable, Debug)] pub struct TurtleCommands { animation_state: usize, commands: Vec, diff --git a/src/drawing.rs b/src/drawing.rs index 1eda672..fa6c2a4 100644 --- a/src/drawing.rs +++ b/src/drawing.rs @@ -6,7 +6,7 @@ pub mod animation; mod line_segments; pub(crate) mod run_step; -#[derive(Inspectable, Default)] +#[derive(Inspectable, Default, Debug)] pub enum TurtleGraphElement { TurtleLine(TurtleDrawLine), TurtleCircle(TurtleDrawCircle), diff --git a/src/drawing/line_segments.rs b/src/drawing/line_segments.rs index ee76338..9447207 100644 --- a/src/drawing/line_segments.rs +++ b/src/drawing/line_segments.rs @@ -16,7 +16,16 @@ pub struct TurtleDrawLine { marker: LineMarker, } -#[derive(Component, Default, Inspectable)] +impl std::fmt::Debug for TurtleDrawLine { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("TurtleDrawLine") + .field("name", &self.name) + .field("marker", &self.marker) + .finish() + } +} + +#[derive(Component, Default, Inspectable, Debug)] struct LineMarker; impl TurtleDrawLine { @@ -45,7 +54,16 @@ pub struct TurtleDrawCircle { marker: CircleMarker, } -#[derive(Component, Default, Inspectable)] +impl std::fmt::Debug for TurtleDrawCircle { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("TurtleDrawCircle") + .field("name", &self.name) + .field("marker", &self.marker) + .finish() + } +} + +#[derive(Component, Default, Inspectable, Debug)] struct CircleMarker; impl TurtleDrawCircle { diff --git a/src/shapes.rs b/src/shapes.rs index d82fdfd..6474ddb 100644 --- a/src/shapes.rs +++ b/src/shapes.rs @@ -6,7 +6,7 @@ pub use turtle::turtle; #[derive(Clone, Component, Inspectable)] pub struct TurtleShape; -#[derive(Clone, Component, Inspectable, Default)] +#[derive(Clone, Component, Inspectable, Default, Debug)] pub struct TurtleColors { color: Color, fill_color: Color, diff --git a/src/state.rs b/src/state.rs index 29b715e..542c2a0 100644 --- a/src/state.rs +++ b/src/state.rs @@ -10,7 +10,7 @@ use crate::{ }; /// Describing the full state of a turtle. -#[derive(Component, Inspectable, Default)] +#[derive(Component, Inspectable, Default, Debug)] pub struct TurtleState { drawing: Vec, position: Coordinate,