#![forbid(unsafe_code)]
#![warn(missing_docs)]
pub use crossterm::terminal::ClearType as ClrT;
use std::io::{stdout, Stdout};
use thiserror::Error;
mod output;
pub mod stylize;
pub use output::*;
pub mod input;
#[derive(Debug)]
pub struct Yogurt {
stdout: Stdout,
size: Option<Point>,
}
impl Yogurt {
pub fn new() -> Self {
Yogurt {
stdout: stdout(),
size: None,
}
}
}
impl Default for Yogurt {
fn default() -> Self {
Yogurt::new()
}
}
#[derive(Debug, Copy, Clone)]
pub struct Point {
pub x: u16,
pub y: u16,
}
impl From<(u16, u16)> for Point {
fn from(t: (u16, u16)) -> Self {
Point { x: t.0, y: t.1 }
}
}
impl From<Point> for (u16, u16) {
fn from(point: Point) -> Self {
(point.x, point.y)
}
}
#[non_exhaustive]
#[derive(Error, Debug)]
pub enum Yarr {
#[error(transparent)]
IO(#[from] std::io::Error),
#[error("tried to use something that depended on alternate mode, but wasn't in it already")]
NotInAltMode,
#[error("tried to convert a crossterm keycode to a yacll keycode but failed")]
FromCrossKeyCodeError,
}
pub type Result<T> = core::result::Result<T, Yarr>;