owen 0.0.1

Terminal User Interface library
Documentation
use std::ops::Add;

#[derive(Copy, Clone, PartialEq, Eq)]
// A structure used to determine the position of an object on the terminal.
// The row and column position start at 0 from the top left corner of the terminal
pub struct Position {
    // The amount of rows from the top of the terminal
    pub row: u16,
    // The amount of columns from the left side of the terminal.
    pub column: u16,
}

impl Position {
    pub fn from(row: u16, column: u16) -> Position {
        Position { row, column }
    }
}

// Used to offset something
impl Add for Position {
    type Output = Position;

    fn add(self, rhs: Self) -> Self::Output {
        Position {
            row: self.row + rhs.row,
            column: self.column + rhs.column,
        }
    }
}

#[derive(Copy, Clone, PartialEq, Eq)]
// A structure to determine the size of an object on the terminal.
// The amount of rows and columns start at 1.
pub struct Size {
    // Vertical Size
    pub rows: u16,
    // Horizontal Size
    pub columns: u16,
}

impl Size {
    pub fn from(rows: u16, columns: u16) -> Size {
        Size { rows, columns }
    }
}

impl Size {
    // The amount of space that the object takes up
    pub fn area(&self) -> u16 {
        self.rows * self.columns
    }
}

// TODO: Write arrangement and constraints