pub struct KeyPressEntry {
pub raw_event: KeyEvent,
pub first_timestamp: DateTime<Local>,
pub last_timestamp: DateTime<Local>,
pub repeat_count: usize,
pub platform: Platform,
pub interpreted_action: Option<String>,
pub app_mode: AppMode,
pub display_string: String,
}Expand description
Represents a single key press with all metadata
Fields§
§raw_event: KeyEventThe raw key event from crossterm
first_timestamp: DateTime<Local>First timestamp when this key was pressed
last_timestamp: DateTime<Local>Last timestamp when this key was pressed (for repeats)
repeat_count: usizeNumber of times this key was pressed consecutively
platform: PlatformThe platform where the key was pressed
interpreted_action: Option<String>The interpreted action (if any) from the key dispatcher
app_mode: AppModeThe mode the app was in when the key was pressed
display_string: StringFormatted display string for the key
Implementations§
Source§impl KeyPressEntry
impl KeyPressEntry
pub fn new(key: KeyEvent, mode: AppMode, action: Option<String>) -> Self
Sourcepub fn is_same_key(&self, key: &KeyEvent, mode: &AppMode) -> bool
pub fn is_same_key(&self, key: &KeyEvent, mode: &AppMode) -> bool
Check if this entry represents the same key press (for coalescing)
Sourcepub fn add_repeat(&mut self)
pub fn add_repeat(&mut self)
Add a repeat to this entry
Sourcepub fn display_with_count(&self) -> String
pub fn display_with_count(&self) -> String
Get display string with repeat count in vim-style notation
Sourcepub fn debug_string(&self) -> String
pub fn debug_string(&self) -> String
Get a detailed debug string for this key press
Trait Implementations§
Source§impl Clone for KeyPressEntry
impl Clone for KeyPressEntry
Source§fn clone(&self) -> KeyPressEntry
fn clone(&self) -> KeyPressEntry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for KeyPressEntry
impl RefUnwindSafe for KeyPressEntry
impl Send for KeyPressEntry
impl Sync for KeyPressEntry
impl Unpin for KeyPressEntry
impl UnwindSafe for KeyPressEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more