pub struct LeaderKeyState {
pub key: KeyCombo,
/* private fields */
}Expand description
State of the leader key
Fields§
§key: KeyComboThe key combination that activates the leader
Implementations§
Source§impl LeaderKeyState
impl LeaderKeyState
Sourcepub fn with_sequence(sequence: Vec<KeyCombo>, timeout_ms: u64) -> Self
pub fn with_sequence(sequence: Vec<KeyCombo>, timeout_ms: u64) -> Self
Create a leader key state with a multi-key prefix sequence
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Deactivate the leader key
Sourcepub fn feed_key(&mut self, combo: &KeyCombo) -> bool
pub fn feed_key(&mut self, combo: &KeyCombo) -> bool
Feed a key to the leader state machine
Returns true if the leader should be activated
Sourcepub fn check_timeout(&mut self) -> bool
pub fn check_timeout(&mut self) -> bool
Check if the leader has timed out
Returns true if timeout occurred, false otherwise
Sourcepub fn time_remaining(&self) -> Option<Duration>
pub fn time_remaining(&self) -> Option<Duration>
Get the time remaining before timeout (if active)
Sourcepub fn timeout_at(&self) -> Option<Instant>
pub fn timeout_at(&self) -> Option<Instant>
Get when the leader will timeout (if active)
Sourcepub fn is_sequence_in_progress(&self) -> bool
pub fn is_sequence_in_progress(&self) -> bool
Check if the sequence is in progress (for multi-key leaders)
Sourcepub fn sequence_progress(&self) -> &[KeyCombo]
pub fn sequence_progress(&self) -> &[KeyCombo]
Get the current sequence progress
Sourcepub fn update_config(&mut self, key: KeyCombo, timeout_ms: u64)
pub fn update_config(&mut self, key: KeyCombo, timeout_ms: u64)
Update the leader key configuration
Trait Implementations§
Source§impl Clone for LeaderKeyState
impl Clone for LeaderKeyState
Source§fn clone(&self) -> LeaderKeyState
fn clone(&self) -> LeaderKeyState
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 moreSource§impl Debug for LeaderKeyState
impl Debug for LeaderKeyState
Source§impl From<LeaderKeyConfig> for LeaderKeyState
impl From<LeaderKeyConfig> for LeaderKeyState
Source§fn from(config: LeaderKeyConfig) -> Self
fn from(config: LeaderKeyConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for LeaderKeyState
impl RefUnwindSafe for LeaderKeyState
impl Send for LeaderKeyState
impl Sync for LeaderKeyState
impl Unpin for LeaderKeyState
impl UnsafeUnpin for LeaderKeyState
impl UnwindSafe for LeaderKeyState
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.