rich/region.rs
1//! Port of upstream `rich/region.py`: a rectangular area of the screen.
2
3/// A rectangular region, as `(x, y, width, height)`. Ordered as upstream's
4/// `NamedTuple` compares: by `x`, then `y`, `width` and `height`.
5#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
6pub struct Region {
7 pub x: usize,
8 pub y: usize,
9 pub width: usize,
10 pub height: usize,
11}
12
13impl Region {
14 /// A region at `(x, y)` of `width` by `height` cells.
15 pub fn new(x: usize, y: usize, width: usize, height: usize) -> Self {
16 Region {
17 x,
18 y,
19 width,
20 height,
21 }
22 }
23}