35 lines
599 B
Rust
35 lines
599 B
Rust
|
use std::io::{Stdout, Write};
|
||
|
use termion::raw::{IntoRawMode, RawTerminal};
|
||
|
|
||
|
extern crate termion;
|
||
|
mod component;
|
||
|
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);
|
||
|
}
|
||
|
}
|