Skip to main content

to_value

Function to_value 

pub fn to_value<T>(value: T) -> Result<Value, Error>
where T: Serialize,
Expand description

Serialize a typed value to a Value.

serde_yaml::to_value takes by value; noyalib takes by reference. Accepts the serde_yaml shape and forwards.

ยงExamples

use noyalib::compat::serde_yaml as syml;
let v = syml::to_value(42_i32).unwrap();
assert_eq!(v.as_i64(), Some(42));