Trait schematic::Config

source ·
pub trait Config: Sized {
    type Partial: PartialConfig;

    const META: ConfigMeta;

    // Required method
    fn from_partial(
        context: &<Self::Partial as PartialConfig>::Context,
        partial: Self::Partial,
        with_env: bool
    ) -> Result<Self, ConfigError>;

    // Provided method
    fn validate(
        &self,
        context: &<Self::Partial as PartialConfig>::Context
    ) -> Result<(), ValidatorError> { ... }
}

Required Associated Types§

Required Associated Constants§

Required Methods§

source

fn from_partial( context: &<Self::Partial as PartialConfig>::Context, partial: Self::Partial, with_env: bool ) -> Result<Self, ConfigError>

Convert a partial configuration into a full configuration, with all values populated. Defaults values from PartialConfig::default_values will be applied first, followed by merging the partial, and lastly environment variable values from PartialConfig::env_values.

Provided Methods§

source

fn validate( &self, context: &<Self::Partial as PartialConfig>::Context ) -> Result<(), ValidatorError>

Recursively validate the configuration with the provided context. Validation should be done on the final state, after merging partials.

Implementors§