//! Helper functions for special characters /// Known special buttons pub enum SpecialButton { Home, Insert, Delete, ArrowUp, ArrowDown, ArrowRight, ArrowLeft, Unknown } /// map special buttons to SpecialButton pub fn get_special_char(ch: &u8) -> SpecialButton { match *ch { 0x31 => { SpecialButton::Home } 0x32 => { SpecialButton::Insert } 0x33 => { SpecialButton::Delete } 0x41 => { SpecialButton::ArrowUp } 0x42 => { SpecialButton::ArrowDown } 0x43 => { SpecialButton::ArrowRight } 0x44 => { SpecialButton::ArrowLeft } _ => { SpecialButton::Unknown } } } /// if character received is backspace pub fn is_backspace(ch: &u8) -> bool { if *ch == 0x08 { return true } false } /// if character received is any number below 'space' in ascii. pub fn is_boring(ch: &u8) -> bool { if *ch <= 0x1F {return true} false }