| ... | ... | @@ -584,36 +584,41 @@ pub fn writeAll(w: *Writer, bytes: []const u8) Error!void { |
| 584 | 584 | /// required, otherwise the digit following ':' is interpreted as **width**. |
| 585 | 585 | /// |
| 586 | 586 | /// **specifier** supports: |
| 587 | | /// - `x` and `X`: numeric value in hexadecimal notation, or string in hexadecimal bytes |
| 588 | | /// - `s`: |
| 587 | /// - "x" and "X": numeric value in hexadecimal notation, or string in hexadecimal bytes |
| 588 | /// - "s": |
| 589 | 589 | /// - for pointer-to-many and C pointers of u8, print as a C-string using zero-termination |
| 590 | 590 | /// - for slices of u8, print the entire slice as a string without zero-termination |
| 591 | | /// - `t`: |
| 591 | /// - "t": |
| 592 | 592 | /// - for enums and tagged unions: prints the tag name |
| 593 | 593 | /// - for error sets: prints the error name |
| 594 | | /// - `b64`: string as standard base64 |
| 595 | | /// - `e`: floating point value in scientific notation |
| 596 | | /// - `d`: numeric value in decimal notation |
| 597 | | /// - `b`: integer value in binary notation |
| 598 | | /// - `o`: integer value in octal notation |
| 599 | | /// - `c`: integer as an ASCII character. Integer type must have 8 bits at max. |
| 600 | | /// - `u`: integer as an UTF-8 sequence. Integer type must have 21 bits at max. |
| 601 | | /// - `B`: bytes in SI units (decimal) |
| 602 | | /// - `Bi`: bytes in IEC units (binary) |
| 603 | | /// - `?`: optional value as either the unwrapped value, or `null`; may be |
| 594 | /// - "b64": string as standard base64 |
| 595 | /// - "e": floating point value in scientific notation |
| 596 | /// - "d": numeric value in decimal notation |
| 597 | /// - "b": integer value in binary notation |
| 598 | /// - "o": integer value in octal notation |
| 599 | /// - "c": integer as an ASCII character. Integer type must have 8 bits at max. |
| 600 | /// - "u": integer as an UTF-8 sequence. Integer type must have 21 bits at max. |
| 601 | /// - "B": bytes in SI units (decimal) |
| 602 | /// - "Bi": bytes in IEC units (binary) |
| 603 | /// - "?": optional value as either the unwrapped value, or `null`; may be |
| 604 | 604 | /// followed by a format specifier for the underlying value. |
| 605 | | /// - `!`: error union value as either the unwrapped value, or the formatted |
| 605 | /// - "!": error union value as either the unwrapped value, or the formatted |
| 606 | 606 | /// error value; may be followed by a format specifier for the underlying |
| 607 | 607 | /// value. |
| 608 | | /// - `*`: the address of the value instead of the value itself. |
| 609 | | /// - `any`: a value of any type using its default format. |
| 610 | | /// - `f`: delegates to the `format` method of the type, passing `*Writer` and |
| 608 | /// - "*": the address of the value instead of the value itself. |
| 609 | /// - "any": a value of any type using its default format. |
| 610 | /// - "f": delegates to the `format` method of the type, passing `*Writer` and |
| 611 | 611 | /// expecting `Error!void` returned. |
| 612 | | /// |
| 613 | | /// A user type may be a struct, vector, union or enum type. |
| 612 | /// - "q": prints as a double-quote escaped string. Inside the double-quoted |
| 613 | /// string, everything is passed through unmodified, except for the following |
| 614 | /// transformations: |
| 615 | /// - escaped: '\n', '\r', '\t', '\\', '"' |
| 616 | /// - hex-encoded: ASCII control characters |
| 617 | /// - "qf": delegates to the `format` method of the type, while double-quote |
| 618 | /// escaping. |
| 614 | 619 | /// |
| 615 | 620 | /// Literal curly braces can be escaped in the format string via doubling, e.g. |
| 616 | | /// `{{` or `}}`. |
| 621 | /// "{{" or "}}". |
| 617 | 622 | pub fn print(w: *Writer, comptime fmt: []const u8, args: anytype) Error!void { |
| 618 | 623 | const ArgsType = @TypeOf(args); |
| 619 | 624 | const args_type_info = @typeInfo(ArgsType); |