2023-01-17 02:06:16 +00:00
|
|
|
use std::io::{Stdout, Write};
|
|
|
|
use termion::raw::{IntoRawMode, RawTerminal};
|
|
|
|
|
|
|
|
extern crate termion;
|
|
|
|
mod component;
|
2023-01-17 11:26:45 +00:00
|
|
|
mod theme;
|
2023-01-17 02:06:16 +00:00
|
|
|
mod token;
|
|
|
|
|
|
|
|
pub struct Display {
|
|
|
|
// needs to hold the termion display
|
|
|
|
screen: RawTerminal<Stdout>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Display {
|
|
|
|
pub fn new() -> Result<Self, anyhow::Error> {
|
|
|
|
Ok(Self {
|
|
|
|
screen: std::io::stdout().into_raw_mode()?,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn add(left: usize, right: usize) -> usize {
|
|
|
|
left + right
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn it_works() {
|
|
|
|
let result = add(2, 2);
|
|
|
|
assert_eq!(result, 4);
|
|
|
|
}
|
|
|
|
}
|