pub struct AddonAction {
pub id: &'static str,
pub name: &'static str,
pub description: &'static str,
pub trigger: Trigger,
pub params: &'static [AddonParam],
pub prerequisite: Option<&'static str>,
}Expand description
One thing an addon can be asked to do.
Fields§
§id: &'static strStable identifier. This is what a binding stores, so it must not change once anyone could have saved it — a rename silently breaks their key.
name: &'static strWhat to call it in a menu.
description: &'static strWhat it does, in a sentence.
trigger: TriggerWhether it wants a press or a position.
params: &'static [AddonParam]What it needs to know, if anything.
prerequisite: Option<&'static str>The step outside Nobble that has to happen for this to work, if there is one.
The same field DeviceAction carries, and for the same reason: a
dependency Nobble cannot verify has to be stated, and an interface
must not claim the key works until the user confirms it. None where
there is nothing to arrange elsewhere, which is almost every action.
It belongs to the action, so an action that only sometimes needs one is two actions. A prerequisite shown on a binding that does not need it teaches people to dismiss the ones that do.
Implementations§
Source§impl AddonAction
impl AddonAction
Sourcepub const BASE: Self
pub const BASE: Self
An action with nothing set, to build from.
Exists for the reason AddonParam::BASE does, learned the same way:
this struct gained a field, and every const array declaring one had to
be edited to say nothing had changed. With ..AddonAction::BASE the
next field costs nobody anything.
The trigger defaults to Trigger::Momentary because most actions are
presses — but it is the one field worth writing out anyway, since a
continuous action silently declared as a press is bindable to a key that
can never supply it a position.
Sourcepub fn param(&self, id: &str) -> Option<&'static AddonParam>
pub fn param(&self, id: &str) -> Option<&'static AddonParam>
One parameter’s declaration, by id.
Trait Implementations§
Source§impl Clone for AddonAction
impl Clone for AddonAction
Source§fn clone(&self) -> AddonAction
fn clone(&self) -> AddonAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AddonAction
impl Debug for AddonAction
Source§impl PartialEq for AddonAction
impl PartialEq for AddonAction
Source§fn eq(&self, other: &AddonAction) -> bool
fn eq(&self, other: &AddonAction) -> bool
self and other values to be equal, and is used by ==.