Skip to main content

Group

Struct Group 

Source
pub struct Group {
    pub title: &'static str,
    pub members: &'static [&'static str],
    pub groups: &'static [Group],
    pub when: Option<Relevance>,
    pub selected_by: Option<Selection>,
}
Expand description

One run of controls under a title, and the state that makes them relevant.

Fields§

§title: &'static str§members: &'static [&'static str]

Registry paths, in reading order.

A member ending in .* is a nested body’s prefix and stands for every field that body registers, in registry order — the whole of organ_a, without naming its nineteen fields.

§groups: &'static [Group]

Groups within this one. Nesting has no depth limit; the layouts here go three deep at most, and a caller should recurse rather than assume.

§when: Option<Relevance>

What makes this group relevant, or None for a group that always is.

§selected_by: Option<Selection>

How this group is selected, where it is one of several stored alternatives such as the two organ presets; None for a group that is not an alternative.

Implementations§

Source§

impl Group

Source

pub fn is_relevant(&self, fields: &[Field]) -> bool

Whether the instrument is using this group’s controls, for the state fields holds.

⚠️ This answers for the group alone. A nested group is relevant only if its parent is too, and nothing here walks up to check — a caller recursing top-down has the answer already, and one starting in the middle does not have a group to start from.

Source

pub fn members_of<'a>(&self, specs: &'a [FieldSpec]) -> Vec<&'a str>

This group’s own members, in reading order, with any prefix.* expanded against the registry. Members of nested groups are not included.

A prefix.* names that body’s controls: a morph slot whose parameter the same body declares is not one, because it is drawn on that parameter. A slot whose parameter is missing has nothing to ride on and is named like any other field.

A member the body does not register is skipped rather than reported: the tests hold layouts to naming only real fields, so a caller need not carry the case.

Trait Implementations§

Source§

impl Debug for Group

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Group

§

impl RefUnwindSafe for Group

§

impl Send for Group

§

impl Sync for Group

§

impl Unpin for Group

§

impl UnsafeUnpin for Group

§

impl UnwindSafe for Group

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.