Expand description
Conversion between JSON text and techy’s serialized values and wire segments.
A techy serialized value (SerialValue) has at most one JSON form (a value
holding a map key that begins with $ has none), and two values have the same
JSON text exactly when they are equal. Comparing two
projections as values and comparing their JSON text
therefore always agree, so a golden file can hold a
projection as readable JSON that a person may edit, without weakening the
comparison.
A wire segment (Segment) is one unit of techy’s serialized stream, as a
serialization session emits it. Its JSON form is
written on one line, so that a stream is one segment per line; flm dump --view wire prints it that way.
from_serde converts any value serde can serialize, such as a
serde_json::json! literal, into a serialized value, which is how a test
writes an expected value.
Functions§
- from_
json - Reads a serialized value from JSON text.
- from_
serde - Converts any value that
serdecan serialize into a techy serialized value. - segment_
from_ line - Reads a wire segment from one line of JSON written by
segment_line. - segment_
line - Writes a wire segment as one line of JSON, with no line break inside it.
- to_json
- Writes a serialized value as JSON on one line, with no space between the tokens.
- to_
json_ pretty - Writes a serialized value as indented JSON: two spaces per level, no trailing newline.
Type Aliases§
- Json
Error - The error type of the JSON functions of this module:
serde_json’s error.