|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
struct Rectangle {
|
|
|
|
|
width: u32,
|
|
|
|
|
height: u32,
|
|
|
|
@ -6,6 +7,8 @@ struct Rectangle {
|
|
|
|
|
fn main() {
|
|
|
|
|
let rect1 = Rectangle { width: 30, height: 50 };
|
|
|
|
|
|
|
|
|
|
println!("rect1 is {:?}", rect1);
|
|
|
|
|
|
|
|
|
|
println!(
|
|
|
|
|
"The area of the rectangle is {} square pixels.",
|
|
|
|
|
area(&rect1)
|
|
|
|
|