Expand description
Canonical source printing: the inverse of Parse.
Every type with a Parse implementation in this crate also implements
Print, and #[derive(Parse)] derives both from the same pattern, so
parse(print(x)) == x holds for every printable value.
Output is canonical and minimal: one space between tokens, , between
list items, no newlines, and no leading or trailing whitespace. Layout
(indentation, line breaks) is left to callers, so printed fragments compose.
Printing fails with fmt::Error when a value has no source spelling that
parses back to the same value, for example a non-finite f64, an empty or
malformed Ident, or Some(x) whose spelling of x would be read as
null.
Traits§
Functions§
- print_
quoted - Write
textas a double-quoted string literal using the escapes accepted by theQuotedStringparser.