pub struct Combo {
pub actions: Vec<KeyAction, COMBO_SIZE>,
pub output: KeyAction,
pub layer: Option<u8>,
}Expand description
Configuration data for a combo.
A combo triggers an output action when a set of keys are pressed simultaneously.
The maximum number of trigger keys is determined by COMBO_SIZE (from constants.rs,
generated at build time from keyboard.toml on firmware or fixed upper bound on host).
Actions are stored in a Vec — only meaningful keys are present (no KeyAction::No padding).
Note: COMBO_SIZE is a wire-format capacity — on firmware it equals
COMBO_MAX_LENGTH (from keyboard.toml), on host it’s a fixed upper bound.
Fields§
§actions: Vec<KeyAction, COMBO_SIZE>§output: KeyAction§layer: Option<u8>Implementations§
Source§impl Combo
impl Combo
Sourcepub fn new<I: IntoIterator<Item = KeyAction>>(
actions: I,
output: KeyAction,
layer: Option<u8>,
) -> Self
pub fn new<I: IntoIterator<Item = KeyAction>>( actions: I, output: KeyAction, layer: Option<u8>, ) -> Self
Create a new combo from an iterator of key actions.
Actions equal to KeyAction::No are filtered out. If there are more
non-No actions than COMBO_SIZE, excess actions are silently dropped.
Sourcepub fn find_key_action_index(&self, key_action: &KeyAction) -> Option<usize>
pub fn find_key_action_index(&self, key_action: &KeyAction) -> Option<usize>
Find the index of a key action in the combo.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Combo
impl<'de> Deserialize<'de> for Combo
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
impl Eq for Combo
Source§impl MaxSize for Combo
impl MaxSize for Combo
Source§const POSTCARD_MAX_SIZE: usize
const POSTCARD_MAX_SIZE: usize
The maximum possible size that the serialization of this
type can have, in bytes.
impl StructuralPartialEq for Combo
Auto Trait Implementations§
impl Freeze for Combo
impl RefUnwindSafe for Combo
impl Send for Combo
impl Sync for Combo
impl Unpin for Combo
impl UnsafeUnpin for Combo
impl UnwindSafe for Combo
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