conformal_component::parameters

Type Alias StaticInfoRef

Source
pub type StaticInfoRef = InfoRef<'static, &'static str>;
Expand description

InfoRef of static data

In many cases, the InfoRef will be a reference to static data, in which case the type parameters can seem noisy. This type alias is here for convenience!

§Examples

let enum_info = StaticInfoRef {
  title: "Enum",
  short_title: "Enum",
  unique_id: "enum",
  flags: Default::default(),
  type_specific: TypeSpecificInfoRef::Enum {
    default: 0,
    values: &["A", "B", "C"],
  },
};
let numeric_info = StaticInfoRef {
  title: "Numeric",
  short_title: "Num",
  unique_id: "numeric",
  flags: Default::default(),
  type_specific: TypeSpecificInfoRef::Numeric {
    default: 0.0,
    valid_range: 0.0..=1.0,
    units: None,
  },
};
let switch_info = StaticInfoRef {
  title: "Switch",
  short_title: "Switch",
  unique_id: "switch",
  flags: Default::default(),
  type_specific: TypeSpecificInfoRef::Switch {
    default: false,
  },
};

Aliased Type§

struct StaticInfoRef {
    pub unique_id: &'static str,
    pub title: &'static str,
    pub short_title: &'static str,
    pub flags: Flags,
    pub type_specific: TypeSpecificInfoRef<'static, &'static str>,
}

Fields§

§unique_id: &'static str

The unique ID of the parameter.

As the name implies, each parameter’s id must be unique within the comonent’s parameters.

Note that this ID will not be presented to the user, it is only used to refer to the parameter in code.

The ID must not begin with the prefix _conformal_internal, as this is reserved for use by the Conformal library itself.

§title: &'static str

Human-readable title of the parameter.

§short_title: &'static str

A short title of the parameter.

In some hosting applications, this may appear as an abbreviated version of the title. If the title is already short, it’s okay to use the same value for title and short_title.

§flags: Flags

Metadata about the parameter

§type_specific: TypeSpecificInfoRef<'static, &'static str>

Information specific to the type of parameter.