Files
unshell/unshell-lib/src/config/config_struct.rs
T

38 lines
863 B
Rust
Raw Normal View History

2025-12-21 00:35:28 -07:00
use serde::{Deserialize, Serialize};
2025-12-17 16:40:34 -07:00
use serde_json::Value;
2025-12-21 00:35:28 -07:00
pub type ConfigStructKeys = Vec<ConfigStructField>;
pub type ConfigStructValues = Vec<Value>;
2025-12-17 16:40:34 -07:00
2025-12-21 00:35:28 -07:00
pub struct Config {
keys: ConfigStructKeys,
values: ConfigStructValues,
}
2025-12-17 16:40:34 -07:00
2025-12-21 00:35:28 -07:00
#[derive(Debug, Clone, Deserialize, Serialize)]
2025-12-17 16:40:34 -07:00
pub enum ConfigStructField {
Header(String),
Text(String),
String {
// Default value of string edit in struct
#[serde(default)]
default: String,
max_length: Option<usize>,
// Display string edit as password
#[serde(default)]
protected: Option<bool>,
},
Integer {
// Default value of integer in struct
#[serde(default)]
default: i32,
min: Option<i32>,
max: Option<i32>,
},
// Checkbox
// Dropdown
// Collapsing header
// Slider
// ...
}