ConfigFile

Struct ConfigFile 

Source
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

Source

pub fn new( technology_settings: Option<ConfigTechnologySettings>, context_override: Vec<ConfigContextSettings>, ) -> Result<Self, Error>

Creates a new ConfigFile.

Source

pub fn from_yaml_str(s: &str) -> Result<Self, Error>

Creates a ConfigFile from a string slice containing YAML data.

Source

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.

Source

pub fn to_yaml_string(&self) -> Result<String, Error>

Serializes self as a YAML string.

Source

pub fn default_technology_settings(&self) -> Option<&ConfigTechnologySettings>

Returns the optional ConfigTechnologySettings.

Source

pub fn contexts(&self) -> &[ConfigContextSettings]

Returns a reference to the list of ConfigContextSettings.

Source

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

Source§

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

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

impl<'de> Deserialize<'de> for ConfigFile

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 ConfigFile

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
Source§

impl Validate for ConfigFile

Source§

type Context = ()

A user-provided context. Read more
Source§

fn validate_into( &self, __garde_user_ctx: &Self::Context, __garde_path: &mut dyn FnMut() -> Path, __garde_report: &mut Report, )

Validates Self, aggregating all validation errors into Report.
§

fn validate(&self) -> Result<(), Report>
where Self::Context: Default,

Validates 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>

Validates Self, returning an Err with an aggregate of all errors if the validation failed. 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> 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, 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>,