pub enum ModifierKey {
Hold(LayerIndex),
SetActiveLayers(LayerBitset),
Default(LayerIndex),
}
Expand description
Modifier layer key affects what layers are active.
Variants§
Hold(LayerIndex)
Activates the given layer when the held.
SetActiveLayers(LayerBitset)
Sets the set of active layers to the given layers when the key is pressed.
Default(LayerIndex)
Sets the default layer.
Implementations§
Source§impl ModifierKey
impl ModifierKey
Sourcepub const fn hold(layer: LayerIndex) -> Self
pub const fn hold(layer: LayerIndex) -> Self
Create a new ModifierKey that activates the given layer when held.
Sourcepub const fn set_active_layers(layers: &[LayerIndex]) -> Self
pub const fn set_active_layers(layers: &[LayerIndex]) -> Self
Create a new ModifierKey that sets the active layers to the given slice of layers when pressed.
Each LayerIndex in the slice must be less than MAX_BITSET_LAYER.
Sourcepub const fn set_active_layers_from_bitset(bitset: LayerBitset) -> Self
pub const fn set_active_layers_from_bitset(bitset: LayerBitset) -> Self
Create a new ModifierKey that sets the active layers bitset.
Sourcepub const fn default(layer: LayerIndex) -> Self
pub const fn default(layer: LayerIndex) -> Self
Create a new ModifierKey that sets the default layer.
Sourcepub fn new_pressed_key(&self) -> (ModifierKeyState, LayerEvent)
pub fn new_pressed_key(&self) -> (ModifierKeyState, LayerEvent)
Create a new input::PressedKey and key::ScheduledEvent for the given keymap index.
Pressing a ModifierKey::Hold emits a LayerEvent::LayerActivated event.
Trait Implementations§
Source§impl Clone for ModifierKey
impl Clone for ModifierKey
Source§fn clone(&self) -> ModifierKey
fn clone(&self) -> ModifierKey
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 ModifierKey
impl Debug for ModifierKey
Source§impl<'de> Deserialize<'de> for ModifierKey
impl<'de> Deserialize<'de> for ModifierKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ModifierKey> for BaseKey
impl From<ModifierKey> for BaseKey
Source§fn from(key: ModifierKey) -> Self
fn from(key: ModifierKey) -> Self
Converts to this type from the input type.
Source§impl Key for ModifierKey
impl Key for ModifierKey
Source§type Context = Context
type Context = Context
The associated Context is used to provide state that
may affect behaviour when pressing the key.
(e.g. the behaviour of layered::LayeredKey depends on which
layers are active in layered::Context).
Source§type Event = Event
type Event = Event
The associated
Event
is to be handled by the associated Context,
pending key states, and key states.Source§type PendingKeyState = PendingKeyState
type PendingKeyState = PendingKeyState
Associated pending key state.
Source§fn new_pressed_key(
&self,
_context: &Self::Context,
key_path: KeyPath,
) -> (PressedKeyResult<Self::PendingKeyState, Self::KeyState>, KeyEvents<Self::Event>)
fn new_pressed_key( &self, _context: &Self::Context, key_path: KeyPath, ) -> (PressedKeyResult<Self::PendingKeyState, Self::KeyState>, KeyEvents<Self::Event>)
Key::new_pressed_key produces a pressed key value, and may
yield some ScheduledEvents.
(e.g. tap_hold::Key schedules a tap_hold::Event::TapHoldTimeout
so that holding the key resolves as a hold).
Source§fn handle_event(
&self,
_pending_state: &mut Self::PendingKeyState,
_context: &Self::Context,
_key_path: KeyPath,
_event: Event<Self::Event>,
) -> (Option<NewPressedKey>, KeyEvents<Self::Event>)
fn handle_event( &self, _pending_state: &mut Self::PendingKeyState, _context: &Self::Context, _key_path: KeyPath, _event: Event<Self::Event>, ) -> (Option<NewPressedKey>, KeyEvents<Self::Event>)
Update the given pending key state with the given impl.
Source§impl PartialEq for ModifierKey
impl PartialEq for ModifierKey
impl Copy for ModifierKey
impl StructuralPartialEq for ModifierKey
impl TapHoldNestable for ModifierKey
Auto Trait Implementations§
impl Freeze for ModifierKey
impl RefUnwindSafe for ModifierKey
impl Send for ModifierKey
impl Sync for ModifierKey
impl Unpin for ModifierKey
impl UnwindSafe for ModifierKey
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