pub struct AddonParam {
pub id: &'static str,
pub name: &'static str,
pub description: &'static str,
pub kind: ParamKind,
pub required: bool,
pub multiple: bool,
pub choices: Option<&'static str>,
}Expand description
One thing an action needs to know, declared so an interface can ask for it.
The point of declaring rather than parsing a free-text argument: FR-048 wants addon configuration built from the shared component library, and there has to be something to build it from. A third-party addon gets the same editor as a first-party one with no code in the interface.
Fields§
§id: &'static strStable identifier, and the key a binding stores it under. Renaming one silently drops whatever the user had chosen.
name: &'static strWhat to call it.
description: &'static strWhat it is for, in a sentence.
kind: ParamKindWhat it holds.
required: boolWhether the action can run without it.
An optional parameter is a real thing rather than an oversight: the media addon’s target application is absent for “whatever is playing”, which is the behaviour most people want most of the time.
multiple: boolWhether it holds several values rather than one (006-FR-024a-i).
Orthogonal to Self::kind on purpose. What a value means and how
many of them there are are different questions, and folding one into the
other is what produces AppList, ParticipantList, PlaylistList —
one new kind every time somebody wants a list of something.
choices: Option<&'static str>The id of an AddonChoices this draws its options from, if any.
None is free text, which is what every parameter was before ADR-0022
and what a choice-backed one degrades to when its list is unavailable.
Implementations§
Source§impl AddonParam
impl AddonParam
Sourcepub const BASE: Self
pub const BASE: Self
A parameter with nothing set, to build from.
Exists so the next field added here does not break every const array
an addon writes: AddonParam { id: "app", ..AddonParam::BASE } compiles
in a const, and adding a field to BASE costs its authors nothing.
It does not save the arrays that already name every field, which is
why the ones in this repository were converted when this was added.
Trait Implementations§
Source§impl Clone for AddonParam
impl Clone for AddonParam
Source§fn clone(&self) -> AddonParam
fn clone(&self) -> AddonParam
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 AddonParam
impl Debug for AddonParam
Source§impl PartialEq for AddonParam
impl PartialEq for AddonParam
Source§fn eq(&self, other: &AddonParam) -> bool
fn eq(&self, other: &AddonParam) -> bool
self and other values to be equal, and is used by ==.