Trait cfg_rs::FromConfig

source ·
pub trait FromConfig: Sized {
    // Required method
    fn from_config(
        context: &mut ConfigContext<'_>,
        value: Option<ConfigValue<'_>>
    ) -> Result<Self, ConfigError>;
}
Expand description

Generate config instance from configuration.

The most power of this crate is automatically deriving this trait. Please refer to Derive FromConfig for details.

Required Methods§

source

fn from_config( context: &mut ConfigContext<'_>, value: Option<ConfigValue<'_>> ) -> Result<Self, ConfigError>

Generate config from ConfigValue under context.

Implementations on Foreign Types§

source§

impl<V: FromConfig> FromConfig for Vec<V>

source§

fn from_config( context: &mut ConfigContext<'_>, _: Option<ConfigValue<'_>> ) -> Result<Self, ConfigError>

source§

impl<V: FromConfig> FromConfig for HashMap<String, V>

source§

fn from_config( context: &mut ConfigContext<'_>, _: Option<ConfigValue<'_>> ) -> Result<Self, ConfigError>

source§

impl FromConfig for ()

source§

impl<V: FromConfig> FromConfig for Result<V, ConfigError>

source§

fn from_config( context: &mut ConfigContext<'_>, value: Option<ConfigValue<'_>> ) -> Result<Self, ConfigError>

source§

impl<V: FromConfig> FromConfig for Option<V>

source§

fn from_config( context: &mut ConfigContext<'_>, value: Option<ConfigValue<'_>> ) -> Result<Self, ConfigError>

Implementors§

source§

impl<T: FromConfig + Send + 'static> FromConfig for RefValue<T>

source§

impl<V: FromValue> FromConfig for V