Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromConfig for ()

Source§

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

Source§

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

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 BTreeMap<String, V>

Source§

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

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>

Implementors§

Source§

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

Source§

impl<V: FromValue> FromConfig for V