Skip to main content

DeclarativeConfig

Struct DeclarativeConfig 

Source
pub struct DeclarativeConfig {
    pub schema_version: u32,
    pub rev: String,
    pub hash: String,
    pub selections: HashMap<String, HashMap<String, Vec<String>>>,
}
Expand description

Declarative FOMOD installation configuration.

Instead of stepping through an interactive wizard, all selections are specified upfront by name. This makes FOMOD installations reproducible and compatible with declarative systems like NixOS.

Uses the nixpkgs rev + hash pattern: rev is a human-readable version identifier and hash is an SRI hash of the installer XML for integrity verification.

§Structure

{
  schema_version = 1;
  rev = "1.2.0";
  hash = "sha256-xbenkdP6HEXuWl9K...";
  selections = {
    "Choose Version" = {
      "Platform" = [ "SSE" ];
    };
  };
}

Fields§

§schema_version: u32

Schema version of this config format. See SCHEMA_VERSION.

§rev: String

Human-readable revision of the FOMOD installer (e.g. mod version).

Sourced from info.xml when available, otherwise the module name.

§hash: String

SRI hash of the source FOMOD XML (sha256-<base64>).

Follows the nixpkgs convention. Used to detect when the upstream installer has changed and this config may need to be regenerated.

§selections: HashMap<String, HashMap<String, Vec<String>>>

Step name → group name → list of selected plugin names.

Implementations§

Source§

impl DeclarativeConfig

Source

pub fn from_defaults( xml: &str, rev: impl Into<String>, config: &ModuleConfig, ) -> Self

Create a template config from a FOMOD module with default selections.

  • xml: raw XML source used to compute the SRI hash
  • rev: human-readable version identifier (e.g. from info.xml)
  • config: parsed FOMOD module configuration
Source

pub fn from_all( xml: &str, rev: impl Into<String>, config: &ModuleConfig, ) -> Self

Create a template config with all available options listed.

Every plugin in every group is included, making it easy to see what’s available and remove what you don’t want.

Source

pub fn apply( &self, xml: &str, installer: &mut Installer, ) -> Result<(), DeclarativeError>

Apply this declarative config to an installer, resolving names to indices.

xml is the raw FOMOD XML source, used to verify the installer hash.

Steps not present in selections use default selections. Groups not present in a step’s map also use defaults. This allows partial configs where you only override what you care about.

Source

pub fn summary(&self) -> Vec<SelectionSummary>

Generate a human-readable summary of all selections.

Source

pub fn diff(&self, other: &DeclarativeConfig) -> Vec<SelectionDiff>

Compute the differences between this config and another.

Trait Implementations§

Source§

impl Clone for DeclarativeConfig

Source§

fn clone(&self) -> DeclarativeConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DeclarativeConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DeclarativeConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for DeclarativeConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,