pub fn to_string<S: Serialize>(value: &S) -> Result<String, Error>
Expand description
A convenience method for serializing some object to a string.
ยงExamples
#[derive(Serialize)]
struct Person {
name: String,
age: u32,
}
let joe = Person {name: "Joe".to_string(), age: 42};
let serialized = to_string(&joe).unwrap();
println!("{}", serialized);