chapter 5 done

This commit is contained in:
Tyrel Souza 2023-02-27 00:15:58 -05:00
parent b5dec65244
commit 645a565719
No known key found for this signature in database
GPG Key ID: F3614B02ACBE438E

View File

@ -13,6 +13,15 @@ impl Rectangle {
}
}
impl Rectangle {
fn square(size: u32) -> Self {
Self {
width: size,
height: size,
}
}
}
@ -29,5 +38,9 @@ fn main() {
println!("Can rect1 hold rect2? {}", rect1.can_hold(&rect2));
println!("Can rect1 hold rect3? {}", rect1.can_hold(&rect3));
let sq = Rectangle::square(5);
println!("r: {:?}", sq);
}