Skip to main content

from_map

Function from_map 

Source
pub fn from_map(
    values: Map<String, Value>,
    origin_description: Option<&str>,
) -> Result<Config, ConfigError>
Expand description

Construct a resolved Config from a serde_json::Map<String, Value>.

Keys are treated as plain keys (NOT path expressions — the key "a.b" creates a top-level entry literally named "a.b", not a nested a.b). Values are coerced to the internal HOCON representation per the E12 value-factory type-coercion table.

from_map never produces substitution placeholders; the returned Config is always resolved (is_resolved() returns true).

origin_description is the user-visible source name for error messages. Pass None to omit.

§Errors

Returns a ConfigError if a value cannot be coerced (e.g. a serde_json::Number that is not representable as either i64 or finite f64).

This function requires the serde feature flag.