[−][src]Function rmpv::ext::to_value
pub fn to_value<T: Serialize>(value: T) -> Result<Value, Error>
Convert a T
into rmpv::Value
which is an enum that can represent any valid MessagePack data.
This conversion can fail if T
's implementation of Serialize
decides to fail.
let val = rmpv::ext::to_value("John Smith").unwrap(); assert_eq!(Value::String("John Smith".into()), val);