changeset 14075 | 3185fb34f3b5 |
parent 14073 | 9c817b2eedae |
child 14080 | c6745a1c827a |
--- a/rust/integral-geometry/src/lib.rs Thu Nov 01 01:07:26 2018 +0100 +++ b/rust/integral-geometry/src/lib.rs Thu Nov 01 03:38:13 2018 +0300 @@ -167,6 +167,16 @@ pub fn new(x: i32, y: i32, width: u32, height: u32) -> Self { Self { x, y, width, height } } + + #[inline] + pub fn size(&self) -> Size { + Size::new(self.width as usize, self.height as usize) + } + + #[inline] + pub fn area(&self) -> usize { + self.size().area() + } }