serde_yaml

Function to_value

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

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.

let val = serde_yaml::to_value("s").unwrap();
assert_eq!(val, Value::String("s".to_owned()));