pub trait ToJson {
type Kind: JsonValueKind;
// Required method
fn json_encode__jsony(&self, output: &mut TextWriter<'_>) -> Self::Kind;
}
Expand description
A trait for converting a value into JSON.
Required Associated Types§
Sourcetype Kind: JsonValueKind
type Kind: JsonValueKind
Represents the kind of JSON value that will be produced.
This can be a string, object, array, or any value that could be one of those or a scalar (e.g., number).
Required Methods§
Sourcefn json_encode__jsony(&self, output: &mut TextWriter<'_>) -> Self::Kind
fn json_encode__jsony(&self, output: &mut TextWriter<'_>) -> Self::Kind
Converts self
to JSON and appends it to the given TextWriter
.
Note: this method is prefixed to avoid collisions in macros that
that invoke it via method resolution.