macro_rules! readable_through_json_value {
($ty:ty) => { ... };
($ty:ty, read) => { ... };
}Expand description
Serde for a type kept as JSON and in a binary format: in a human-readable
format (JSON, a serde_json::Value, serde’s buffered content) it is read
and written through one Value, by functions compiled once in the crate
that declares it; in any other (postcard) by its derived code, unchanged.
The type derives with #[serde(remote = "Self")], as for
read_through_json_value!. A crate that reads or writes the type as JSON
then compiles only the Value step, not the type’s whole serializer and
deserializer (and, for an internally tagged or flattened type, its buffered
copy) once per format it meets. The JSON is the same: a Value’s map keeps
the order its fields were written in. read routes only reading, for a
type whose Serialize is its own.