pub struct Keys;
impl Keys {
pub const ENTER: &'static str = "Enter";
pub const TAB: &'static str = "Tab";
pub const ESCAPE: &'static str = "Escape";
pub const BACKSPACE: &'static str = "Backspace";
pub const DELETE: &'static str = "Delete";
pub const INSERT: &'static str = "Insert";
pub const SPACE: &'static str = "Space";
pub const HOME: &'static str = "Home";
pub const END: &'static str = "End";
pub const PAGE_UP: &'static str = "PageUp";
pub const PAGE_DOWN: &'static str = "PageDown";
pub const ARROW_UP: &'static str = "ArrowUp";
pub const ARROW_DOWN: &'static str = "ArrowDown";
pub const ARROW_LEFT: &'static str = "ArrowLeft";
pub const ARROW_RIGHT: &'static str = "ArrowRight";
pub const CONTROL: &'static str = "Control";
pub const SHIFT: &'static str = "Shift";
pub const ALT: &'static str = "Alt";
pub const META: &'static str = "Meta";
}
#[derive(Debug, Clone)]
pub enum KeyInput {
Text(String),
Key(String),
}
impl KeyInput {
pub fn text(s: impl Into<String>) -> Self {
KeyInput::Text(s.into())
}
pub fn key(s: impl Into<String>) -> Self {
KeyInput::Key(s.into())
}
}
impl From<&str> for KeyInput {
fn from(s: &str) -> Self {
KeyInput::Text(s.to_string())
}
}
impl From<String> for KeyInput {
fn from(s: String) -> Self {
KeyInput::Text(s)
}
}