Skip to main content

AddonAction

Struct AddonAction 

Source
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 str

Stable 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 str

What to call it in a menu.

§description: &'static str

What it does, in a sentence.

§trigger: Trigger

Whether 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

Source

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.

Source

pub fn param(&self, id: &str) -> Option<&'static AddonParam>

One parameter’s declaration, by id.

Trait Implementations§

Source§

impl Clone for AddonAction

Source§

fn clone(&self) -> AddonAction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AddonAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AddonAction

Source§

fn eq(&self, other: &AddonAction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for AddonAction

Source§

impl Eq for AddonAction

Source§

impl StructuralPartialEq for AddonAction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.