Skip to main content

from_value

Function from_value 

pub fn from_value<T>(value: Value) -> Result<T, Error>
where T: DeserializeOwned + 'static,
Expand description

Deserialize a typed value from a Value.

serde_yaml::from_value takes the Value by value; noyalib takes it by reference. This adapter accepts the serde_yaml-style by-value form so call sites do not need to add an & during migration.

ยงExamples

use noyalib::compat::serde_yaml as syml;
let v = syml::Value::Number(syml::Number::Integer(42));
let n: i32 = syml::from_value(v).unwrap();
assert_eq!(n, 42);