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§
Sourcefn from_config(
context: &mut ConfigContext<'_>,
value: Option<ConfigValue<'_>>,
) -> Result<Self, ConfigError>
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.