1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/// A directional vector with no positional information.
pub struct Vector {
    x: u16,
    y: u16,
}

impl Vector {
    /// Create a new, immutable vector.
    ///
    /// # Examples
    /// ```
    /// use tty_interface::Vector;
    ///
    /// let size = Vector::new(7, 4);
    /// assert_eq!(7, size.x());
    /// assert_eq!(4, size.y());
    /// ```
    pub fn new(x: u16, y: u16) -> Vector {
        Vector { x, y }
    }

    /// This vector's column value.
    pub fn x(&self) -> u16 {
        self.x
    }

    /// This vector's line value.
    pub fn y(&self) -> u16 {
        self.y
    }
}