pub trait ToJson {
// Required method
fn to_json_string(&self) -> String;
}Expand description
Trait that converts a type to a JSON string.
This trait has a derive macro.
Required Methods§
Sourcefn to_json_string(&self) -> String
fn to_json_string(&self) -> String
Converts self to a JSON string.
Implementations of this should not fail.
Implementations on Foreign Types§
Source§impl ToJson for str
FIXME: this doesn’t correctly handle newlines
and other escaped characters like "
impl ToJson for str
FIXME: this doesn’t correctly handle newlines
and other escaped characters like "
fn to_json_string(&self) -> String
Source§impl<A> ToJson for (A,)where
A: ToJson,
ToJson is implemented for tuples up to size 12.
impl<A> ToJson for (A,)where
A: ToJson,
ToJson is implemented for tuples up to size 12.