#[derive(WidgetCommand)]Expand description
Typed command declarations for widget operations.
Generates a WidgetCommandEncode implementation that converts
each variant to an (op, PropValue) pair for wire transport.
Variant names become snake_case operation strings.
Uses the same variant forms as WidgetEvent:
- Unit:
Resetproduces("reset", PropValue::Null) - Single-field tuple:
SetValue(f32)produces("set_value", PropValue::F64(v)) - Named fields:
SetRange { min: f32, max: f32 }produces("set_range", PropValue::Object({min: ..., max: ...}))
§Example
ⓘ
#[derive(WidgetCommand)]
enum GaugeCommand {
/// Set gauge to a value immediately.
SetValue(f32),
/// Reset gauge to zero.
Reset,
/// Set the value range.
SetRange { min: f32, max: f32 },
}
// Usage:
Command::widget("temp", GaugeCommand::SetValue(72.0))