pub trait ToJSON: Type {
// Required method
fn to_json(&self) -> Option<Value>;
// Provided method
fn to_json_string(&self) -> String { ... }
}
Expand description
Represents a type that can converted to JSON value.
Required Methods§
Provided Methods§
Sourcefn to_json_string(&self) -> String
fn to_json_string(&self) -> String
Convert this value to JSON string.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.