pub enum OptimizedEvent<M> {
Key(KeyEvent),
Mouse(MouseEvent),
Resize {
width: u16,
height: u16,
},
Tick,
User(InlineMessage<M>),
Quit,
Focus,
Blur,
Suspend,
Resume,
Paste(Cow<'static, str>),
// some variants omitted
}Expand description
Zero-cost event wrapper with inline storage for small messages
Variants§
Key(KeyEvent)
A keyboard event - stored inline, no allocation
Mouse(MouseEvent)
A mouse event - stored inline, no allocation
Resize
Terminal was resized - stored inline, no allocation
Tick
A tick event - stored inline, no allocation
User(InlineMessage<M>)
User-defined message with inline storage optimization
Quit
Request to quit the program - stored inline, no allocation
Focus
Terminal gained focus - stored inline, no allocation
Blur
Terminal lost focus - stored inline, no allocation
Suspend
Program suspend request (Ctrl+Z) - stored inline, no allocation
Resume
Program resumed from suspend - stored inline, no allocation
Paste(Cow<'static, str>)
Bracketed paste event with COW string for efficiency
Implementations§
Source§impl<M> OptimizedEvent<M>
impl<M> OptimizedEvent<M>
Sourcepub fn is_key_press(&self, key: Key) -> bool
pub fn is_key_press(&self, key: Key) -> bool
Check if this is a specific key press
Sourcepub const fn as_mouse(&self) -> Option<&MouseEvent>
pub const fn as_mouse(&self) -> Option<&MouseEvent>
Get the mouse event if this is a mouse event
Trait Implementations§
Source§impl<M: Clone> Clone for OptimizedEvent<M>
impl<M: Clone> Clone for OptimizedEvent<M>
Source§fn clone(&self) -> OptimizedEvent<M>
fn clone(&self) -> OptimizedEvent<M>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<M: Debug> Debug for OptimizedEvent<M>
impl<M: Debug> Debug for OptimizedEvent<M>
Source§impl<M> From<Event<M>> for OptimizedEvent<M>
Convert from the standard Event to OptimizedEvent
impl<M> From<Event<M>> for OptimizedEvent<M>
Convert from the standard Event to OptimizedEvent
Source§impl<M> From<OptimizedEvent<M>> for Event<M>
Convert from OptimizedEvent back to standard Event
impl<M> From<OptimizedEvent<M>> for Event<M>
Convert from OptimizedEvent back to standard Event