pub struct ConfigFile {
pub(crate) default_technology_settings: Option<ConfigTechnologySettings>,
pub(crate) contexts: Vec<ConfigContextSettings>,
}Expand description
Representation of a VOA configuration file.
Fields§
§default_technology_settings: Option<ConfigTechnologySettings>Technology defaults for an OS.
contexts: Vec<ConfigContextSettings>Context overrides for an OS.
§Note
This list can be empty, if technology_defaults is set, else there has to be at least one
entry.
Implementations§
Source§impl ConfigFile
impl ConfigFile
Sourcepub fn new(
technology_settings: Option<ConfigTechnologySettings>,
context_override: Vec<ConfigContextSettings>,
) -> Result<Self, Error>
pub fn new( technology_settings: Option<ConfigTechnologySettings>, context_override: Vec<ConfigContextSettings>, ) -> Result<Self, Error>
Creates a new ConfigFile.
Sourcepub fn from_yaml_str(s: &str) -> Result<Self, Error>
pub fn from_yaml_str(s: &str) -> Result<Self, Error>
Creates a ConfigFile from a string slice containing YAML data.
Sourcepub fn from_yaml_file(
path: impl AsRef<Path>,
file_type: ConfigFileType,
) -> Result<Self, Error>
pub fn from_yaml_file( path: impl AsRef<Path>, file_type: ConfigFileType, ) -> Result<Self, Error>
Creates a ConfigFile from a file containing YAML data.
The additional file_type sets the origin according to whether the file is a default
configuration file or a drop-in configuration file.
Sourcepub fn to_yaml_string(&self) -> Result<String, Error>
pub fn to_yaml_string(&self) -> Result<String, Error>
Serializes self as a YAML string.
Sourcepub fn default_technology_settings(&self) -> Option<&ConfigTechnologySettings>
pub fn default_technology_settings(&self) -> Option<&ConfigTechnologySettings>
Returns the optional ConfigTechnologySettings.
Sourcepub fn contexts(&self) -> &[ConfigContextSettings]
pub fn contexts(&self) -> &[ConfigContextSettings]
Returns a reference to the list of ConfigContextSettings.
Sourcepub fn origins(&self) -> &[ConfigOrigin]
pub fn origins(&self) -> &[ConfigOrigin]
Returns a reference to the list of config file origins.
§Note
This returns an empty list, if neither settings nor context settings contain origins.
However, this can not happen, as the validation of ConfigFile does not allow it.
Trait Implementations§
Source§impl Debug for ConfigFile
impl Debug for ConfigFile
Source§impl<'de> Deserialize<'de> for ConfigFile
impl<'de> Deserialize<'de> for ConfigFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for ConfigFile
impl Serialize for ConfigFile
Source§impl Validate for ConfigFile
impl Validate for ConfigFile
Source§fn validate_into(
&self,
__garde_user_ctx: &Self::Context,
__garde_path: &mut dyn FnMut() -> Path,
__garde_report: &mut Report,
)
fn validate_into( &self, __garde_user_ctx: &Self::Context, __garde_path: &mut dyn FnMut() -> Path, __garde_report: &mut Report, )
Self, aggregating all validation errors into Report.§fn validate(&self) -> Result<(), Report>where
Self::Context: Default,
fn validate(&self) -> Result<(), Report>where
Self::Context: Default,
Self, returning an Err with an aggregate of all errors if
the validation failed. Read more§fn validate_with(&self, ctx: &Self::Context) -> Result<(), Report>
fn validate_with(&self, ctx: &Self::Context) -> Result<(), Report>
Self, returning an Err with an aggregate of all errors if
the validation failed. Read more