trpl-zh-cn/listings/ch11-writing-automated-tests/listing-11-05/src/lib.rs
2024-10-20 23:44:05 +08:00

12 lines
212 B
Rust

#[derive(Debug)]
struct Rectangle {
width: u32,
height: u32,
}
impl Rectangle {
fn can_hold(&self, other: &Rectangle) -> bool {
self.width > other.width && self.height > other.height
}
}