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§
type Partial: PartialConfig
Required Associated Constants§
const META: ConfigMeta
Required Methods§
sourcefn from_partial(
context: &<Self::Partial as PartialConfig>::Context,
partial: Self::Partial,
with_env: bool
) -> Result<Self, ConfigError>
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§
sourcefn validate(
&self,
context: &<Self::Partial as PartialConfig>::Context
) -> Result<(), ValidatorError>
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.