display/size.rs
1/// Represents a terminal window size.
2#[derive(Copy, Clone, Debug, PartialEq, Eq)]
3pub struct Size {
4 width: usize,
5 height: usize,
6}
7
8impl Size {
9 /// Create a new instance with a width and height.
10 #[inline]
11 #[must_use]
12 pub const fn new(width: usize, height: usize) -> Self {
13 Self { width, height }
14 }
15
16 /// Get the width.
17 #[inline]
18 #[must_use]
19 pub const fn width(&self) -> usize {
20 self.width
21 }
22
23 /// Get the height.
24 #[inline]
25 #[must_use]
26 pub const fn height(&self) -> usize {
27 self.height
28 }
29}