Trait mas_config::ConfigurationSection

source ·
pub trait ConfigurationSection: Sized + DeserializeOwned {
    const PATH: Option<&'static str> = None;

    // Provided methods
    fn validate(&self, _figment: &Figment) -> Result<(), FigmentError> { ... }
    fn extract(figment: &Figment) -> Result<Self, FigmentError> { ... }
Expand description

Trait implemented by all configuration section to help loading specific part of the config and generate the sample config.

Provided Associated Constants§


const PATH: Option<&'static str> = None

Specify where this section should live relative to the root.

Provided Methods§


fn validate(&self, _figment: &Figment) -> Result<(), FigmentError>

Validate the configuration section


Returns an error if the configuration is invalid


fn extract(figment: &Figment) -> Result<Self, FigmentError>

Extract configuration from a Figment instance.


Returns an error if the configuration could not be loaded

Object Safety§

This trait is not object safe.