Expand description
JSON printing.
Print is the entry point. pretty_print, inline_print and
compact_print cover the common cases; print_with takes an Options
for everything else — indentation, padding, and the width or item count at
which an array or object is expanded onto several lines.
Printing is a two-pass process: sizes are precomputed
(PrecomputeSize), then written out (PrintWithSize), so the layout
decision for a nested value is known before it is emitted.
Strings are escaped per RFC 8785.
Structs§
- Indent
By - An
Indentrepeated a given number of times, ready to be displayed. - Options
- Print options.
- Printed
- Printed value.
- Spaces
- The given number of spaces, ready to be displayed.
Enums§
- Indent
- Indentation unit.
- Limit
- Threshold past which an array or object is expanded onto several lines.
- Padding
- Padding inserted between syntactic elements.
- Size
- The size of a value.
Traits§
- Precompute
Size - Computation of the printed layout, ahead of printing.
- Print methods.
- Print
With Size - Printing with precomputed sizes.
Functions§
- pre_
compute_ array_ size - Computes the printed size of an array made of
items. - pre_
compute_ object_ size - Computes the printed size of an object made of
entries. - print_
array - Writes
itemsas a JSON array, using the layout atsizes[*index]. - print_
object - Writes
entriesas a JSON object, using the layout atsizes[*index]. - printed_
string_ size - Returns the byte length of string literal according to RFC8785.
- string_
literal - Formats a string literal according to RFC8785.