pub fn parse(file: &str) -> Result<Value<'_>>
Expand description
Parses the input string into a Config
containing the resolved inputs
and a map of values representing the top-level object.
Examples
use corn::parse;
let corn = "{foo = 42}";
let config = parse(corn).unwrap();
let json = serde_json::to_string(&config).unwrap();
assert_eq!(json, "{\"foo\":42}");
Errors
Will fail if the input contains a syntax error. Will fail if the input contains invalid Corn for another reason, including references to undefined inputs or dot-notation for non-object values. Will fail if the input cannot be deserialized for any reaon.
Any of the above will return a specific error type with details.
Panics
If the internal AST parser produces a tree in an invalid structure, the function will panic. This indicates a severe error in the library and should never occur.