pub fn from_str<T>(s: &str) -> Result<T>where
T: DeserializeOwned + 'static,Expand description
Deserialize a YAML document into the target type — with
serde_yaml 0.9’s observable behaviour, not noyalib’s
defaults.
The shim parses under crate::ParserConfig::serde_yaml_compat:
<< merge keys stay literal entries (alias values resolved),
leading-zero integers stay strings and 0b11 is 3, a literal
float overflow stays a string, u64-range integers keep full
precision and one past u64::MAX errors, non-scalar keys error,
transitive alias expansion is budgeted exactly as upstream
(“repetition limit exceeded”), and a duplicate mapping key is
refused when the target is Value (duplicate entry with key "k"), as upstream refuses it for its own Value; a struct target
refuses a repeated field (duplicate field `k` ) and a map target
keeps the last entry, as upstream does. Callers who want noyalib’s own
(spec-strict) defaults should use crate::from_str directly.
§Examples
use noyalib::compat::serde_yaml as syml;
let n: i32 = syml::from_str("42").unwrap();
assert_eq!(n, 42);