You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
712 B
Rust
28 lines
712 B
Rust
use anyhow::Context;
|
|
use serde::{Deserialize, Serialize};
|
|
use std::collections::HashMap;
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct GlobalConfig {
|
|
pub qemu: GlobalQemuConfig,
|
|
pub uefi: HashMap<String, GlobalUefiConfig>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
pub struct GlobalQemuConfig {
|
|
pub script: String,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
#[serde(rename_all(deserialize = "kebab-case"))]
|
|
pub struct GlobalUefiConfig {
|
|
pub template: String,
|
|
pub boot_code: String,
|
|
}
|
|
|
|
impl GlobalConfig {
|
|
pub fn load(toml: &str) -> Result<GlobalConfig, anyhow::Error> {
|
|
toml::from_str(toml).context("Failed to parse toml for global config")
|
|
}
|
|
}
|