[][src]Function serde_yaml::to_value

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

Convert a T into serde_yaml::Value which is an enum that can represent any valid YAML data.

This conversion can fail if T's implementation of Serialize decides to return an error.

This code runs with edition 2018
let val = serde_yaml::to_value("s").unwrap();
assert_eq!(val, Value::String("s".to_owned()));