ostree_ext/
repo_options.rs

1//! Configuration options for an ostree repository
2
3use serde::{Deserialize, Serialize};
4
5/// Configuration options for an ostree repository.
6///
7/// This struct represents configurable options for an ostree repository
8/// that can be set via the `ostree config set` command.
9#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10#[serde(rename_all = "kebab-case", default)]
11pub struct RepoOptions {
12    /// Boot Loader Spec entries that should append arguments only for non-default entries.
13    ///
14    /// Corresponds to the `sysroot.bls-append-except-default` ostree config key.
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub bls_append_except_default: Option<String>,
17}
18
19impl RepoOptions {
20    /// Returns an iterator of (key, value) tuples for ostree repo configuration.
21    ///
22    /// Each tuple represents an ostree config key and its value, suitable for
23    /// passing to `ostree config set`.
24    pub fn to_config_tuples(&self) -> impl Iterator<Item = (&'static str, &str)> {
25        self.bls_append_except_default
26            .as_ref()
27            .map(|v| ("sysroot.bls-append-except-default", v.as_str()))
28            .into_iter()
29    }
30}