serde_hjson::value

Function to_value

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

Shortcut function to encode a T into a Hjson Value

use serde_hjson::to_value;
let val = to_value("foo");
assert_eq!(val.unwrap().as_str(), Some("foo"))