We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 92dff5b commit e8140dbCopy full SHA for e8140db
c5_struct/src/main.rs
@@ -1,4 +1,4 @@
1
-
+#[derive(Debug)]
2
struct Rectangle {
3
width: u32,
4
height: u32,
@@ -42,9 +42,10 @@ fn main() {
42
"The area of the rectangle is {} square pixels.",
43
rect1.area()
44
);
45
+ let scale=2;
46
47
let rect1 = Rectangle {
- width: 30,
48
+ width: dbg!(30*scale),
49
height: 50,
50
};
51
let rect2 = Rectangle {
@@ -55,7 +56,9 @@ fn main() {
55
56
width: 60,
57
height: 45,
58
59
+ // dbg!() takes ownership of an expression. We use & instead.
60
+ dbg!(&rect1);
61
+ dbg!(&rect3);
62
println!("Can rect1 hold rect2? {}", rect1.can_hold(&rect2));
63
println!("Can rect1 hold rect3? {}", rect1.can_hold(&rect3));
64
0 commit comments