//! Input mode for the command field. //! //! See ADR-0003 for the design. The two modes determine how the //! input field interprets a submitted line. The `:` one-shot //! escape from simple to advanced is handled at submission time //! in `app::App::submit`, not as additional state here. use std::fmt; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Mode { Simple, Advanced, } impl Mode { pub const fn label(self) -> &'static str { match self { Self::Simple => "SIMPLE", Self::Advanced => "ADVANCED", } } } impl fmt::Display for Mode { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.label()) } }