Files
kira-installer/src/stage.rs
T

64 lines
1.6 KiB
Rust
Raw Normal View History

// <Kira Installer - universal Linux installer.>
// Copyright (C) <2026> <Kira Foundation>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/*
This file contains basic enums and structs to be used with stages.
*/
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub enum ConfigValue {
String(String),
I64(i64),
U64(u64),
F64(f64),
Bool(bool),
Vector(Vec<ConfigValue>),
Dictionary(HashMap<String, ConfigValue>)
}
#[derive(Debug, Clone)]
pub struct StageResult {
pub name: String,
pub config: Option<HashMap<String, ConfigValue>>,
pub resuts: Option<HashMap<String, ConfigValue>>,
pub error: Option<String>
}
#[derive(Debug, Clone)]
pub enum StageAction {
Back,
None,
Next(StageResult),
2026-05-01 23:32:25 +02:00
Abort,
}
pub struct KiraConfig {
pub config_trail: Vec<StageResult>,
}
2026-05-03 00:56:20 +02:00
impl KiraConfig {
pub fn get_stage(&self, name: &str) -> Option<StageResult> {
self.config_trail.iter().find(|v| v.name == name)
.and_then(|v| Some(v.clone()))
}
}