pub fn from_str<T>(input: &str) -> Result<T, Error>where
T: DeserializeOwned,Expand description
Deserializes a YAML document using YAML 1.1 scalar resolution.
Configuration files are commonly written against YAML 1.1 parsers, so plain scalars resolve the way those parsers resolve them rather than by the stricter YAML 1.2 core schema:
yes/no,on/off, andy/n(in any case) are booleans.- Integers with a leading zero, such as
012, are octal. <<merge keys are expanded.
Non-finite floats (.inf, .nan) in untyped positions are kept as their string spelling rather than rejecting
the whole document, leaving it to the consumer of that value to decide whether it’s valid.
The default limits on the number of parsed nodes and events are lifted, as configuration files can legitimately hold very large lists. Nesting depth, alias expansion, and total scalar size are still bounded.
Errors report only a message and location, never the surrounding source lines, as configuration files can hold credentials. Comments are not retained, so runs of comments don’t count against the comment limits.
§Errors
If the document isn’t valid YAML, or doesn’t deserialize as T, an error is returned.