mirror of
https://github.com/RGBCube/superfreq
synced 2025-07-27 17:07:44 +00:00
config: fix schema, toml does not have top level lists
This commit is contained in:
parent
0d3a88be03
commit
c073b640dc
1 changed files with 5 additions and 3 deletions
|
@ -111,7 +111,9 @@ pub struct DaemonConfigLayer {
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)]
|
#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)]
|
||||||
#[serde(transparent, default, rename_all = "kebab-case")]
|
#[serde(transparent, default, rename_all = "kebab-case")]
|
||||||
pub struct DaemonConfig(pub Vec<DaemonConfigLayer>);
|
pub struct DaemonConfig {
|
||||||
|
config: Vec<DaemonConfigLayer>,
|
||||||
|
}
|
||||||
|
|
||||||
impl DaemonConfig {
|
impl DaemonConfig {
|
||||||
pub fn load_from(path: &Path) -> anyhow::Result<Self> {
|
pub fn load_from(path: &Path) -> anyhow::Result<Self> {
|
||||||
|
@ -122,9 +124,9 @@ impl DaemonConfig {
|
||||||
let config: Self = toml::from_str(&contents).context("failed to parse config file")?;
|
let config: Self = toml::from_str(&contents).context("failed to parse config file")?;
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut priorities = Vec::with_capacity(config.0.len());
|
let mut priorities = Vec::with_capacity(config.config.len());
|
||||||
|
|
||||||
for layer in &config.0 {
|
for layer in &config.config {
|
||||||
if priorities.contains(&layer.priority) {
|
if priorities.contains(&layer.priority) {
|
||||||
bail!("each config layer must have a different priority")
|
bail!("each config layer must have a different priority")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue