[][src]Enum keyberon::action::Action

#[non_exhaustive]pub enum Action {
    NoOp,
    Trans,
    KeyCode(KeyCode),
    MultipleKeyCodes(&'static [KeyCode]),
    MultipleActions(&'static [Action]),
    Layer(usize),
    DefaultLayer(usize),
    HoldTap {
        timeout: u16,
        hold: &'static Action,
        tap: &'static Action,
    },
}

The different actions that can be done.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
NoOp

No operation action: just do nothing.

Trans

Transparent, i.e. get the action from the default layer. On the default layer, it is equivalent to NoOp.

KeyCode(KeyCode)

A key code, i.e. the classical key.

MultipleKeyCodes(&'static [KeyCode])

Multiple key codes send at the same time, as it you press all these keys at the same time. Useful to send shifted key, or complex short cuts as Ctrl+Alt+Del in a single key press.

MultipleActions(&'static [Action])

Multiple actions send at the same time.

Layer(usize)

While pressed, change the current layer. That's the classical Fn key. If several layer actions are active at the same time, their number are summed. For example, if you press at the same time Layer(1) and Layer(2), layer 3 will be active.

DefaultLayer(usize)

Change the default layer.

HoldTap

If the key is hold more than timeout units of time (usually milliseconds), performs the hold action, else performs the tap action. Mostly used with a modifier for the hold action and a classical key on the tap action. Any action can be performed, but using a HoldTap in an HoldTap is not specified (but guaranteed to not crash).

Fields of HoldTap

timeout: u16

The duration, in ticks (usually milliseconds) giving the difference between a hold and a tap.

hold: &'static Action

The hold action.

tap: &'static Action

The tap action.

Implementations

impl Action[src]

pub fn layer(self) -> Option<usize>[src]

Gets the layer number if the action is the Layer action.

pub fn key_codes<'a>(&'a self) -> impl Iterator<Item = KeyCode> + 'a[src]

Returns an iterator on the KeyCode corresponding to the action.

Trait Implementations

impl Clone for Action[src]

impl Copy for Action[src]

impl Debug for Action[src]

impl Eq for Action[src]

impl PartialEq<Action> for Action[src]

impl StructuralEq for Action[src]

impl StructuralPartialEq for Action[src]

Auto Trait Implementations

impl Send for Action

impl Sync for Action

impl Unpin for Action

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.