pub struct AddonChoices {
pub id: &'static str,
pub name: &'static str,
pub live: bool,
pub values: &'static [AddonChoice],
}Expand description
A named list of options an addon offers, which a parameter can draw from.
ADR-0022. Named rather than attached to one parameter, and the third reason below is the one that decided it:
- a live fetch is then one addon and one id, where a parameter would need
(addon, action, param)— and a setting’s parameter has no action; - two parameters can share one list, so a pin and a priority pointing at the same people cannot show two different rosters;
- composition belongs to the addon.
006-FR-011bwants the current call, then people remembered from previous calls, then free text — an ordering that is Discord’s business. With a named source the addon returns one flat ordered list and the interface renders it, so “remembered people” needs no interface support at all.
Fields§
§id: &'static strStable id, unique within the addon. A parameter names this.
name: &'static strWhat the list is, for the editor’s heading and its empty state.
live: boolWhether the values must be asked for rather than read from below.
A declared source is fixed for the life of the daemon and arrives
with everything else. A live one changes — a voice roster, the
playlists on an account — and is fetched when somebody opens the picker
and at no other time. Not polled: a timer would cost idle CPU for a
picker nobody has open, which 006-FR-027 forbids and 006-SC-008
measures.
values: &'static [AddonChoice]Every value, for a declared source. Empty when Self::live.
Trait Implementations§
Source§impl Clone for AddonChoices
impl Clone for AddonChoices
Source§fn clone(&self) -> AddonChoices
fn clone(&self) -> AddonChoices
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 AddonChoices
impl Debug for AddonChoices
Source§impl PartialEq for AddonChoices
impl PartialEq for AddonChoices
Source§fn eq(&self, other: &AddonChoices) -> bool
fn eq(&self, other: &AddonChoices) -> bool
self and other values to be equal, and is used by ==.