tty_interface/
vector.rs

1/// A directional vector with no positional information.
2pub struct Vector {
3    x: u16,
4    y: u16,
5}
6
7impl Vector {
8    /// Create a new, immutable vector.
9    ///
10    /// # Examples
11    /// ```
12    /// use tty_interface::Vector;
13    ///
14    /// let size = Vector::new(7, 4);
15    /// assert_eq!(7, size.x());
16    /// assert_eq!(4, size.y());
17    /// ```
18    pub fn new(x: u16, y: u16) -> Vector {
19        Vector { x, y }
20    }
21
22    /// This vector's column value.
23    pub fn x(&self) -> u16 {
24        self.x
25    }
26
27    /// This vector's line value.
28    pub fn y(&self) -> u16 {
29        self.y
30    }
31}