rust/integral-geometry/src/lib.rs
changeset 14725 19d30d96d7d6
parent 14717 16024046d458
child 14726 75ff5c643004
equal deleted inserted replaced
14724:fbd385a1bcf4 14725:19d30d96d7d6
   309 }
   309 }
   310 
   310 
   311 impl Rect {
   311 impl Rect {
   312     pub const EMPTY: Self = Self {
   312     pub const EMPTY: Self = Self {
   313         top_left: Point::ZERO,
   313         top_left: Point::ZERO,
   314         bottom_right: Point::ZERO,
   314         bottom_right: Point::diag(-1),
   315     };
   315     };
   316 
   316 
   317     #[inline]
   317     #[inline]
   318     pub fn new(top_left: Point, bottom_right: Point) -> Self {
   318     pub fn new(top_left: Point, bottom_right: Point) -> Self {
   319         debug_assert!(top_left.x <= bottom_right.x + 1);
   319         debug_assert!(top_left.x <= bottom_right.x + 1);
   452     }
   452     }
   453 
   453 
   454     #[inline]
   454     #[inline]
   455     pub fn with_margins(&self, left: i32, right: i32, top: i32, bottom: i32) -> Self {
   455     pub fn with_margins(&self, left: i32, right: i32, top: i32, bottom: i32) -> Self {
   456         Self::from_box(
   456         Self::from_box(
   457             self.left() + left,
   457             self.left() - left,
   458             self.right() + right,
   458             self.right() + right,
   459             self.top() + top,
   459             self.top() - top,
   460             self.bottom() + bottom,
   460             self.bottom() + bottom,
   461         )
   461         )
   462     }
   462     }
   463 
   463 
   464     #[inline]
   464     #[inline]