pub struct Keymap<const CAP: usize = 64> { /* private fields */ }Expand description
定长无堆作用域快捷键路由表与弦键状态机(默认最多 64 条绑定,支持 #![no_std])。
Implementations§
Source§impl<const CAP: usize> Keymap<CAP>
impl<const CAP: usize> Keymap<CAP>
pub const fn new() -> Self
Sourcepub fn set_chord_timeout_ms(&mut self, timeout_ms: u32)
pub fn set_chord_timeout_ms(&mut self, timeout_ms: u32)
设置弦键前缀等待超时毫秒数(默认 1500ms)。
Sourcepub fn bind(&mut self, binding: KeyBinding) -> bool
pub fn bind(&mut self, binding: KeyBinding) -> bool
注册一条快捷键绑定(后注册的同作用域绑定具有更高优先级,允许用户覆盖默认键位)。
Sourcepub fn reset_pending(&mut self)
pub fn reset_pending(&mut self)
复位进行中的弦键前缀状态。
Sourcepub const fn has_pending_chord(&self) -> bool
pub const fn has_pending_chord(&self) -> bool
返回当前是否正在等待两段弦键的第二个按键。
Trait Implementations§
Auto Trait Implementations§
impl<const CAP: usize> Forget for Keymap<CAP>
impl<const CAP: usize> Freeze for Keymap<CAP>
impl<const CAP: usize> Move for Keymap<CAP>
impl<const CAP: usize> RefUnwindSafe for Keymap<CAP>
impl<const CAP: usize> Send for Keymap<CAP>
impl<const CAP: usize> Sync for Keymap<CAP>
impl<const CAP: usize> Unpin for Keymap<CAP>
impl<const CAP: usize> UnsafeUnpin for Keymap<CAP>
impl<const CAP: usize> UnwindSafe for Keymap<CAP>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。