pub fn from_value<T>(value: &Value) -> Result<T>where
T: for<'de> Deserialize<'de> + 'static,Expand description
Deserialize a Value into a typed T via Serde’s data model.
Useful for second-pass conversion when the first pass parsed
into the dynamic Value tree and a typed view is now needed
for a sub-tree.
§Errors
Error::Deserialize—valuedoes not matchT’s shape.Error::Custom— surfaces upstreamserde_core::de::Errorconversions that don’t fit the structured variants.
§Examples
use noyalib::{from_value, Value};
let v = Value::from(42_i64);
let n: i32 = from_value(&v).unwrap();
assert_eq!(n, 42);