pub enum SettingValue {
Bool(bool),
Choice {
options: Vec<String>,
selected: usize,
},
Number {
value: i32,
min: i32,
max: i32,
step: i32,
},
Display(String),
Action(ActionType),
}Expand description
Types of setting values
Variants§
Bool(bool)
Boolean toggle (checkbox)
Choice
Multiple choice (dropdown)
Number
Numeric value with bounds
Display(String)
Read-only display value
Action(ActionType)
Action button
Implementations§
Source§impl SettingValue
impl SettingValue
Sourcepub const fn cycle_next(&mut self)
pub const fn cycle_next(&mut self)
Cycle to next choice option
Sourcepub const fn cycle_prev(&mut self)
pub const fn cycle_prev(&mut self)
Cycle to previous choice option
Sourcepub const fn quick_select(&mut self, index: u8)
pub const fn quick_select(&mut self, index: u8)
Quick select a choice by index (1-based)
Sourcepub fn display_value(&self) -> String
pub fn display_value(&self) -> String
Get the current value as a display string
Sourcepub const fn is_display(&self) -> bool
pub const fn is_display(&self) -> bool
Check if this is a display-only value
Sourcepub const fn choice_count(&self) -> Option<usize>
pub const fn choice_count(&self) -> Option<usize>
Get choice options count (for rendering [1/2/3] hints)
Source§impl SettingValue
impl SettingValue
Sourcepub fn from_option_with_constraint(
opt: &OptionValue,
constraint: &OptionConstraint,
) -> Self
pub fn from_option_with_constraint( opt: &OptionValue, constraint: &OptionConstraint, ) -> Self
Create a SettingValue from an OptionValue with constraint information.
Uses the constraint’s min/max for integer bounds.
Sourcepub fn item_from_spec(spec: &OptionSpec, value: &OptionValue) -> SettingItem
pub fn item_from_spec(spec: &OptionSpec, value: &OptionValue) -> SettingItem
Create a SettingItem from an OptionSpec with its current value.
Sourcepub fn to_option_value(&self) -> Option<OptionValue>
pub fn to_option_value(&self) -> Option<OptionValue>
Convert this SettingValue back to an OptionValue.
Note: Display and Action variants cannot be converted and return None.
Trait Implementations§
Source§impl Clone for SettingValue
impl Clone for SettingValue
Source§fn clone(&self) -> SettingValue
fn clone(&self) -> SettingValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SettingValue
impl Debug for SettingValue
Source§impl From<&OptionValue> for SettingValue
impl From<&OptionValue> for SettingValue
Source§fn from(opt: &OptionValue) -> Self
fn from(opt: &OptionValue) -> Self
Convert an OptionValue to a SettingValue without constraint information.
For integers, uses unbounded min/max. Use SettingValue::from_option_with_constraint
for proper bounds.