revi_ui/
lib.rs

1#![warn(clippy::all, clippy::pedantic)]
2mod key;
3mod ui;
4pub use key::Key;
5pub use ui::screen_size;
6pub use ui::Tui;
7
8pub trait Display {
9    fn render(&self, func: impl FnMut(u16, u16, String));
10    fn cursor(&self, func: impl FnMut(u16, u16, Option<CursorShape>));
11}
12
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub enum CursorShape {
15    UnderScore,
16    Line,
17    Block,
18}
19
20impl From<CursorShape> for crossterm::cursor::CursorShape {
21    fn from(cs: CursorShape) -> Self {
22        use crossterm::cursor::CursorShape::{Block, Line, UnderScore};
23        match cs {
24            CursorShape::UnderScore => UnderScore,
25            CursorShape::Line => Line,
26            CursorShape::Block => Block,
27        }
28    }
29}