appcui 0.4.8

A feature-rich and cross-platform TUI/CUI framework for Rust, enabling modern terminal-based applications on Windows, Linux, and macOS. Includes built-in UI components like buttons, menus, list views, tree views, checkboxes, and more. Perfect for building fast and interactive CLI tools and text-based interfaces.
Documentation
use std::fmt::Display;

#[repr(u8)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum ErrorKind {
    InitializationFailure,
    InvalidFeature,
    InvalidParameter,
}

#[derive(Debug)]
pub struct Error {
    pub kind: ErrorKind,
    // Note: Do we really need this string stored?
    description: String,
}

impl Error {
    pub(crate) fn new(kind: ErrorKind, description: String) -> Self {
        Self { kind, description }
    }
}

impl std::error::Error for Error {
    fn description(&self) -> &str {
        &self.description
    }
}

impl Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", &self.description)
    }
}