Function rbs::value::ext::to_value

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

Convert a T into rbs::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 = rbs::to_value("John Smith").unwrap();

assert_eq!(Value::String("John Smith".into()), val);