In Rust, the Debug
trait allows you to format your types using the {:?}
formatter, making it easier to inspect and debug your code. Instead of manually implementing the Debug
trait for every struct, Rust provides the convenient #[derive(Debug)]
attribute to automatically generate a Debug
implementation.
For this challenge, you will work with structs that represent different types of data. Your task is to implement the Debug
trait using the derive
macro and demonstrate its functionality with sample structs.
Person
, Point
, Rectangle
).Debug
trait for each struct using #[derive(Debug)]
.#[derive(Debug)]
attribute for all structs.